Jump to content

Sexy primes: Difference between revisions

Added Quackery.
m (syntax highlighting fixup automation)
(Added Quackery.)
Line 2,475:
999983
1000003
</pre>
 
=={{header|Quackery}}==
 
<code>eratosthenes</code> and <code>primes</code> are defined at [[Sieve of Eratosthenes#Quackery]].
 
<syntaxhighlight lang="Quackery"> 1000035 eratosthenes
 
[ stack ] is pairs ( --> s )
[ stack ] is trips ( --> s )
[ stack ] is quads ( --> s )
[ stack ] is quins ( --> s )
[ stack ] is unsexy ( --> s )
 
[ share swap bit & 0 != ] is in ( s n --> b )
 
primes share dup
' [ pairs trips quads quins ]
witheach
[ dip [ dip dup 6 >> & dup ] put ]
2drop
 
pairs share
dup 6 << | ~
primes share &
unsexy put
 
' [ pairs trips quads quins ]
witheach
[ temp put
[] 1000035 times
[ i^ temp share in if
[ i^ join ] ]
dup size echo sp
-5 split echo drop cr
temp release ]
cr
[] 1000035 6 - times
[ i^ unsexy in if
[ i^ join ] ]
dup size echo sp
-10 split echo drop cr</syntaxhighlight>
 
{{out}}
 
<pre>16386 [ 999371 999431 999721 999763 999953 ]
2900 [ 997427 997541 998071 998617 998737 ]
325 [ 977351 983771 986131 990371 997091 ]
1 [ 5 ]
 
48627 [ 999853 999863 999883 999907 999917 999931 999961 999979 999983 1000003 ]
</pre>
 
1,462

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.