迭代序列
The following iterative sequence is defined for the set of positive integers:
n n/2 (n is even)
n 3n + 1 (n is odd)
Using the rule above and starting with 13, we generate the following sequence:
13 40 20 10 5 16 8 4 2 1
It can be seen that this sequence (starting at 13 and finishing at 1) contains 10 terms. Although it has not been proved yet (Collatz Problem), it is thought that all starting numbers finish at 1.
Which starting number, under one million, produces the longest chain?
NOTE: Once the chain starts the terms are allowed to go above one million.
找出1,000,000以内,迭代次数最多的数。
分享到:
相关推荐
投影仪Project Euler 问题的解决方案,请参阅地位# 名称秒1 3 和 5 的倍数0.02 甚至斐波那契数列0.03 最大素因数0.94 最大的回文产品0.15 最小倍数2.56 和平方差0.07 第 10001 个素数0.1解决方案8 系列中最大的产品...
这个压缩包`euler project.r.zip_R Euler project_project`包含了R语言实现的Euler项目前14题的答案。让我们深入探讨这些题目所涵盖的知识点,并了解如何利用R语言解决这些问题。 1. **Problem 1: 多少个数小于1000...
6. **数学函数与库**:虽然 Project Euler 鼓励自行实现算法,但JavaScript 内置了一些数学函数(如 Math.pow、Math.sqrt),以及第三方库(如 math.js),可以帮助简化计算。 7. **递归**:许多 Project Euler ...
hacktoberfest-projecteuler 此回购包含针对投影仪问题的解决方案。 专为新手打造,作为Hacktoberfest挑战赛的一部分。 谨向所有人提出请求,在发送任何请求请求之前,请在上测试您的解决方案。 问题清单 问题#1 ...
请记住,您应该避免浏览希望解决的任何问题的解决方案(如Project Euler网站上所述)。 依存关系 该项目是使用以C ++开发的。 到目前为止,我一直在尝试避免使用任何第三方库,因此该代码应该能够使用任何支持C ++ ...