Combinations with repetitions/Square digit chain: Difference between revisions
Content added Content deleted
(Added Kotlin) |
m (→{{header|Kotlin}}: Minor changes to wording of preamble.) |
||
Line 137: | Line 137: | ||
=={{header|Kotlin}}== |
=={{header|Kotlin}}== |
||
To achieve reasonable performance, the Kotlin entry for the [[Iterated digits squaring]] task used a similar approach to that required by this task for k = 8. |
To achieve reasonable performance, the Kotlin entry for the [[Iterated digits squaring]] task already used a similar approach to that required by this task for k = 8. |
||
So the following generalizes that code to deal with values of k up to 17 (which requires 64 bit integers) and to |
So the following generalizes that code to deal with values of k up to 17 (which requires 64 bit integers) and to count numbers where the squared digits sum sequence eventually ends in 1 rather than 89, albeit the sum of both must of course be 10 ^ k - 1. |
||
<lang scala>// version 1.1.51 |
<lang scala>// version 1.1.51 |
||