16 lines
347 B
Plaintext
16 lines
347 B
Plaintext
# project euler 60
|
||
# ? n
|
||
IsPrime ← memo(=1⧻°/×)
|
||
# [all pair-concatenations of [n]] ? [n]
|
||
Pairs ← ≡(⍜°⋕/◇⊂) ⧅≠2
|
||
# [all primes 1 through n] ? n
|
||
Primes ← +1⊚≡IsPrime+1⇡
|
||
# do numbers [n] form all prime Pairs?
|
||
# bool ? [n]
|
||
Check ← /↧≡IsPrime Pairs
|
||
|
||
⍤⤙≍ 1 Check [3 7 109 673]
|
||
|
||
⧅<4 Primes 1000
|
||
▽⊸≡Check
|