N-smooth numbers: Difference between revisions
Content added Content deleted
m (Rust - task doesn't need arbitrary precision integers, 128-bit is sufficient.) |
(Added Quackery.) |
||
Line 2,946: | Line 2,946: | ||
The 30000 to 3019 521 -smooth numbers are: |
The 30000 to 3019 521 -smooth numbers are: |
||
[62287, 62288, 62291, 62292, 62300, 62304, 62307, 62308, 62310, 62315, 62320, 62321, 62322, 62325, 62328, 62329, 62330, 62331, 62335, 62336]</pre> |
[62287, 62288, 62291, 62292, 62300, 62304, 62307, 62308, 62310, 62315, 62320, 62321, 62322, 62325, 62328, 62329, 62330, 62331, 62335, 62336]</pre> |
||
=={{header|Quackery}}== |
|||
<lang Quackery> |
|||
[ behead 0 swap rot |
|||
witheach |
|||
[ 2dup < iff |
|||
drop done |
|||
nip nip |
|||
i^ 1+ swap ] ] is smallest ( [ --> n n ) |
|||
[ stack ] is end.test ( --> s ) |
|||
[ ]'[ end.test put |
|||
dup temp put |
|||
' [ 1 ] |
|||
0 rot size of |
|||
[ over end.test share do if done |
|||
[] unrot |
|||
dup dip |
|||
[ witheach |
|||
[ dip dup peek |
|||
temp share i^ peek * |
|||
rot swap join swap ] ] |
|||
rot smallest |
|||
dip |
|||
[ 2dup peek 1+ unrot poke ] |
|||
rot swap over |
|||
-1 peek over = iff |
|||
drop else join |
|||
swap again ] |
|||
drop |
|||
end.test release |
|||
temp release ] is smoothwith ( [ --> [ ) |
|||
[ ' [ 2 3 5 7 11 13 17 19 23 29 ] |
|||
swap split drop ] is primes ( n --> [ ) |
|||
10 times |
|||
[ i^ 1+ primes |
|||
smoothwith [ size 25 = ] |
|||
echo cr ] |
|||
cr |
|||
9 times |
|||
[ i^ 2 + primes |
|||
smoothwith [ size 3002 = ] |
|||
-3 split nip echo cr ]</lang> |
|||
{{out}} |
|||
<pre>[ 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 ] |
|||
[ 1 2 3 4 6 8 9 12 16 18 24 27 32 36 48 54 64 72 81 96 108 128 144 162 192 ] |
|||
[ 1 2 3 4 5 6 8 9 10 12 15 16 18 20 24 25 27 30 32 36 40 45 48 50 54 ] |
|||
[ 1 2 3 4 5 6 7 8 9 10 12 14 15 16 18 20 21 24 25 27 28 30 32 35 36 ] |
|||
[ 1 2 3 4 5 6 7 8 9 10 11 12 14 15 16 18 20 21 22 24 25 27 28 30 32 ] |
|||
[ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 18 20 21 22 24 25 26 27 28 ] |
|||
[ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 20 21 22 24 25 26 27 ] |
|||
[ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 25 26 ] |
|||
[ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 ] |
|||
[ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 ] |
|||
[ 91580367978306252441724649472 92829823186414819915547541504 94096325042746502515294076928 ] |
|||
[ 278942752080 279936000000 281250000000 ] |
|||
[ 50176000 50331648 50388480 ] |
|||
[ 2112880 2116800 2117016 ] |
|||
[ 390000 390390 390625 ] |
|||
[ 145800 145860 146016 ] |
|||
[ 74256 74358 74360 ] |
|||
[ 46552 46575 46585 ] |
|||
[ 33516 33524 33534 ] |
|||
</pre> |
|||
=={{header|Raku}}== |
=={{header|Raku}}== |