Sexy primes: Difference between revisions
Content added Content deleted
(→{{header|J}}: fix unsexy bug) |
(→{{header|J}}: rely on params, not globals) |
||
Line 966: | Line 966: | ||
sp =: dyad define |
sp =: dyad define |
||
' |
'pd os' =. x NB. prime distance, orgy size |
||
p =. pngt y |
p =. pngt y |
||
o =. orgy p |
o =. orgy p |
||
g =. o +/&.> <\ +/\ _1 |.!.0 os # |
g =. o +/&.> <\ +/\ _1 |.!.0 os # pd NB. Groups |
||
's g' =. split g NB. Split singles from groups |
's g' =. split g NB. Split singles from groups |
||
Line 978: | Line 978: | ||
NB. it causes the kind of edge-case issues the spec warns |
NB. it causes the kind of edge-case issues the spec warns |
||
NB. about with 1000033 |
NB. about with 1000033 |
||
us =. |
us =. p (] #~ [: +:/ 1 p: +/)~ (+,-) pd NB. Unsexy numbers |
||
( (#&.> g) ,. l ) ,~ (# ; _10&{.) us |
( (#&.> g) ,. l ) ,~ (# ; _10&{.) us |
||
) |
) |