Happy numbers: Difference between revisions

m
(→‎{{header|Commodore BASIC}}: Add implementation.)
Line 1,066:
 
==={{header|Commodore BASIC}}===
The array sizes here are tuned to the minimum values required to find the first 8 happy numbers in numerical order. The <tt>H</tt> and <tt>U</tt> arrays are used for memoization, so the subscripts <tt>H(</tt><i>Nn</i><tt>)</tt> and <tt>U(</tt><i>Nn</i><tt>)</tt> must exist for the highest <i>Nn</i> consideredencountered. The array <tt>N</tt> must have room to hold the longest chain examined in the course of determining whether a single number is happy, which thanks to the memoization is only ten elements long.
 
<syntaxhighlight lang="gwbasic">
1,480

edits