Anonymous user
Ulam numbers: Difference between revisions
m
→{{header|REXX}}: added whitespace, split a line.
(Added Sidef) |
m (→{{header|REXX}}: added whitespace, split a line.) |
||
Line 1,020:
th: parse arg th; return word('th st nd rd', 1 + (th//10)*(th//100%10\==1)*(th//10<4))
/*──────────────────────────────────────────────────────────────────────────────────────*/
Ulam: parse arg n; @.1= 1; @.2= 2;
!.= 0; !.1= 1; !.2=
z= 3 /*value of next possible term in seq. */
do until #==n
Line 1,032:
if cnt==2 then do; #= # + 1 /*bump the number of terms. */
@.#= z
!.z= 1 /*set the semaphore for Z. */
end
z= z + 1 /*bump next possible term. */
|