Ludic numbers: Difference between revisions

m (→‎{{header|REXX}}: spelling)
Line 2,501:
Ludic numbers 2000..2005: (21475 21481 21487 21493 21503 21511)
Ludic triples < 250: (<1 3 7> <5 7 11> <11 13 17> <23 25 29> <41 43 47> <173 175 179> <221 223 227> <233 235 239>)</pre>
 
=={{header|Phix}}==
{{trans|Fortran}}
<lang Phix>constant LUMAX = 25000
sequence ludic = repeat(1,LUMAX)
integer n
for i=2 to LUMAX/2 do
if ludic[i] then
n = 0
for j=i+1 to LUMAX do
n += ludic[j]
if n=i then
ludic[j] = 0
n = 0
end if
end for
end if
end for
 
sequence s = {}
for i=1 to LUMAX do
if ludic[i] then
s &= i
if length(s)=25 then exit end if
end if
end for
printf(1,"First 25 Ludic numbers: %s\n",{sprint(s)})
printf(1,"Ludic numbers below 1000: %d\n",{sum(ludic[1..1000])})
s = {}
n = 0
for i=1 to LUMAX do
if ludic[i] then
n += 1
if n>=2000 then
s &= i
if n=2005 then exit end if
end if
end if
end for
printf(1,"Ludic numbers 2000 to 2005: %s\n",{sprint(s)})
s = {}
for i=1 to 243 do
if ludic[i] and ludic[i+2] and ludic[i+6] then
s = append(s,{i,i+2,i+6})
end if
end for
printf(1,"There are %d Ludic triplets below 250: %s\n",{length(s),sprint(s)})</lang>
{{out}}
<pre>
First 25 Ludic numbers: {1,2,3,5,7,11,13,17,23,25,29,37,41,43,47,53,61,67,71,77,83,89,91,97,107}
Ludic numbers below 1000: 142
Ludic numbers 2000 to 2005: {21475,21481,21487,21493,21503,21511}
There are 8 Ludic triplets below 250: {{1,3,7},{5,7,11},{11,13,17},{23,25,29},{41,43,47},{173,175,179},{221,223,227},{233,235,239}}
</pre>
 
=={{header|PicoLisp}}==
7,795

edits