Anonymous user
Kaprekar numbers: Difference between revisions
m
→{{header|REXX}}: changed a comment (box), changed output section title.
SqrtNegInf (talk | contribs) m (→Numeric version (medium): added '.race' for concurrency) |
m (→{{header|REXX}}: changed a comment (box), changed output section title.) |
||
Line 3,907:
=={{header|REXX}}==
<lang rexx>/*REXX pgm generates & counts (+ maybe shows) some Kaprekar #s using the cast─out─9 test*/
/*
║ Kaprekar numbers were thought of by the mathematician from India, ║
║ Shri Dattathreya Ramachardra Kaprekar (1905 ───► 1986). ║
parse arg A B . /*obtain optional arguments from the CL*/
if A=='' | A="," then A= 10000 /*Not specified? Then use the default.*/
Line 3,922:
if aN>0 then call tell 1 /*unity is defined to be a Kaprekar #. */
/* [↑] handle case of N being unity.*/
if aN>1 then do j=
if j//9==s//9 then do k=1 for length(s)%2 /*≡ casted out 9's?*/
parse var s L +(k) R
Line 3,933:
/*──────────────────────────────────────────────────────────────────────────────────────*/
tell: #=#+1; if N>0 then say right(arg(1), digits()); return /*maybe display it*/</lang>
<pre>
1
|