Steady squares: Difference between revisions
Content added Content deleted
Line 1,991: | Line 1,991: | ||
1: { 1 5 6 25 76 376 625 9376 } |
1: { 1 5 6 25 76 376 625 9376 } |
||
</pre> |
</pre> |
||
===Slight optimization=== |
|||
Steady numbers must end with 5 or 6, but there's no double-digits-or-more ones ending with 1: if ##b1 was the base 10 representation of such a number, the 2nd digit from the right shall be b (because of steadiness) and 2b (because of the elevation to square), which means b=0. By recurrence, all digits shall be zero. |
|||
≪ { 1 } 0 ROT '''FOR''' n |
|||
5 6 '''FOR''' j |
|||
n j + →STR LAST SQ →STR |
|||
DUP SIZE 3 PICK SIZE - 1 + OVER SIZE SUB |
|||
'''IF''' == '''THEN''' n j + + '''END''' |
|||
'''NEXT''' |
|||
10 '''STEP''' |
|||
≫ ‘STEDY’ STO |
|||
== {{header|TypeScript}} == |
== {{header|TypeScript}} == |