Truncatable primes: Difference between revisions
Content added Content deleted
m (Forth - simplified code) |
m (Forth - simplified code) |
||
Line 1,209: | Line 1,209: | ||
drop false exit |
drop false exit |
||
then |
then |
||
dup |
dup >r |
||
10 |
|||
begin |
begin |
||
2dup > |
|||
while |
while |
||
2dup mod |
|||
dup |
dup r> = if |
||
2drop |
2drop drop false exit |
||
then |
then |
||
dup prime? invert if |
dup prime? invert if |
||
2drop |
2drop drop false exit |
||
then |
then |
||
>r |
|||
10 * |
10 * |
||
repeat |
repeat |
||
2drop |
2drop rdrop true ; |
||
: right_truncatable_prime? ( n -- flag ) |
: right_truncatable_prime? ( n -- flag ) |