Anonymous user
Sexy primes: Difference between revisions
→{{header|J}}: fix unsexy bug
m (→{{header|J}}: spacing) |
(→{{header|J}}: fix unsexy bug) |
||
Line 966:
sp =: dyad define
's os' =. x NB. prime distance,
p =. pngt y
o =. orgy p
Line 974:
l =. (({.~ -) 5 <. #)&.> g NB. Last (max) 5 groups
NB. I'm sure there's something clever with p-.s or similar,
NB. but (a) I don't want to think through it, and (b)
NB. it causes the kind of edge-case issues the spec warns
NB. about with 1000033
us =. _6 6 (] #~ [: +:/ 1 p: +/) p NB. Unsexy numbers
( (#&.> g) ,. l ) ,~ (# ; _10&{.) us
)
r =: 1000035 sp~ SEX,ORGY_SIZE
smoutput (;:'Group Count Examples') , (;:'Unsexy Pair Triplets Quadruplets Quintuplets') ,. r</lang>
{{out}}
Line 983 ⟶ 991:
|Group |Count|Examples |
+-----------+-----+----------------------------------------------------------------------+
|Unsexy |
+-----------+-----+----------------------------------------------------------------------+
|Pair |16386|999371 999377 |
|