Ludic numbers: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 3,085: | Line 3,085: | ||
Ludic 2000 to 2005: 21475 21481 21487 21493 21503 21511 |
Ludic 2000 to 2005: 21475 21481 21487 21493 21503 21511 |
||
Triples 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) |
Triples 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|SequenceL}}== |
|||
<lang sequenceL> |
|||
import <Utilities/Set.sl>; |
|||
ludic(v(1), result(1)) := |
|||
let |
|||
n := head(v); |
|||
filtered[i] := v[i] when (i-1) mod n /= 0; |
|||
in |
|||
result when size(v) < 1 else |
|||
ludic(filtered, result ++ [n]); |
|||
count : int(1) * int * int -> int; |
|||
count(v(1), top, index) := |
|||
index-1 when v[index] > top else |
|||
count(v, top, index + 1); |
|||
main() := |
|||
let |
|||
ludics := ludic(2...100000, [1]); |
|||
ludics250 := ludics[1 ... count(ludics, 250, 1)]; |
|||
triplets[i] := [i, i+2, i+6] when elementOf(i+2, ludics250) and elementOf(i+6, ludics250) |
|||
foreach i within ludics250; |
|||
in |
|||
"First 25:\n" ++ toString(ludics[1...25]) ++ |
|||
"\n\nLudics below 1000:\n" ++ toString(count(ludics, 1000, 1)) ++ |
|||
"\n\nLudic 2000 to 2005:\n" ++ toString(ludics[2000...2005]) ++ |
|||
"\n\nTriples below 250:\n" ++ toString(triplets) ; |
|||
</lang> |
|||
{{out}} |
|||
<pre> |
|||
First 25: |
|||
[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] |
|||
Ludics below 1000: |
|||
142 |
|||
Ludic 2000 to 2005: |
|||
[21475,21481,21487,21493,21503,21511] |
|||
Triples 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> |
</pre> |
||