One-two primes: Difference between revisions
Content added Content deleted
(add RPL) |
(Added Quackery.) |
||
Line 680: | Line 680: | ||
show_oeis36229() |
show_oeis36229() |
||
</syntaxhighlight>{{out}} same as Wren, etc. |
</syntaxhighlight>{{out}} same as Wren, etc. |
||
=={{header|Quackery}}== |
|||
<code>1-2-prime</code> returns the first qualifying prime of the specified number of digits, or -1 if no qualifying prime found. |
|||
<code>prime</code> is defined at [[Miller–Rabin primality test#Quackery]]. |
|||
<syntaxhighlight lang="Quackery"> [ temp put |
|||
-1 |
|||
2 temp share ** times |
|||
[ [] i^ |
|||
temp share times |
|||
[ dup 1 & |
|||
rot join swap |
|||
1 >> ] |
|||
swap witheach |
|||
[ 1+ swap 10 * + ] |
|||
dup prime iff |
|||
[ nip conclude ] |
|||
done |
|||
drop ] |
|||
temp release ] is 1-2-prime ( n --> n ) |
|||
[] 20 times [ i^ 1+ 1-2-prime join ] |
|||
witheach [ echo cr ]</syntaxhighlight> |
|||
{{out}} |
|||
<pre>2 |
|||
11 |
|||
211 |
|||
2111 |
|||
12211 |
|||
111121 |
|||
1111211 |
|||
11221211 |
|||
111112121 |
|||
1111111121 |
|||
11111121121 |
|||
111111211111 |
|||
1111111121221 |
|||
11111111112221 |
|||
111111112111121 |
|||
1111111112122111 |
|||
11111111111112121 |
|||
111111111111112111 |
|||
1111111111111111111 |
|||
11111111111111212121 |
|||
</pre> |
|||
=={{header|Raku}}== |
=={{header|Raku}}== |