freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-122-efficient-expon...

22 lines
652 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
id: 5900f3e61000cf542c50fef9
title: 问题122有效取幂
challengeType: 5
videoUrl: ''
---
# --description--
最简单的计算n15的方法需要十四次乘法n×n×...×n = n15但是使用“二进制”方法可以在六次乘法中计算它n×n = n2n2×n2 = n4n4×n4 = n8n8 ×n4 = n12n12×n2 = n14n14×n = n15然而只能在五次乘法中计算它n×n = n2n2×n = n3n3×n3 = n6n6×n6 = n12n12×n3 = n15我们将定义m k是计算nk的最小乘法数;例如m15= 5.对于1≤k≤200找到Σmk
# --hints--
`euler122()`应返回1582。
```js
assert.strictEqual(euler122(), 1582);
```
# --solutions--