Iterated digits squaring: Difference between revisions

Added XPL0 example.
(Added XPL0 example.)
Line 3,797:
ret
</syntaxhighlight>
 
=={{header|XPL0}}==
Simple minded brute force takes 30 seconds on Pi4.
<syntaxhighlight lang "XPL0">int C, N, M, S;
[C:= 0;
for N:= 1 to 100_000_000-1 do
[M:= N;
loop [S:= 0;
repeat M:= M/10;
S:= S + rem(0)*rem(0);
until M = 0;
if S = 89 then
[C:= C+1; quit];
if S = 1 then quit;
M:= S;
];
];
IntOut(0, C);
]</syntaxhighlight>
{{out}}
<pre>
85744333</pre>
 
=={{header|zkl}}==
297

edits