Ludic numbers: Difference between revisions

Content added Content deleted
(→‎{{header|Tcl}}: + standard ML)
(Added 11l)
Line 40: Line 40:


<br><br>
<br><br>

=={{header|11l}}==
{{trans|Python}}

<lang 11l>F ludic(nmax = 100000)
V r = [1]
V lst = Array(2..nmax)
L !lst.empty
r.append(lst[0])
[Int] newlst
V step = lst[0]
L(i) 0 .< lst.len
I i % step != 0
newlst.append(lst[i])
lst = newlst
R r

V ludics = ludic()
print(‘First 25 ludic primes:’)
print(ludics[0.<25])
print("\nThere are #. ludic numbers <= 1000".format(sum(ludics.filter(l -> l <= 1000).map(l -> 1))))
print("\n2000'th..2005'th ludic primes:")
print(ludics[2000 - 1 .. 2004])
V n = 250
V triplets = ludics.filter(x -> x + 6 < :n &
x + 2 C :ludics &
x + 6 C :ludics).map(x -> (x, x + 2, x + 6))
print("\nThere are #. triplets less than #.:\n #.".format(triplets.len, n, triplets))</lang>

{{out}}
<pre>
First 25 ludic primes:
[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]

There are 142 ludic numbers <= 1000

2000'th..2005'th ludic primes:
[21475, 21481, 21487, 21493, 21503, 21511]

There are 8 triplets less than 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|360 Assembly}}==
=={{header|360 Assembly}}==