8
1
Sexy Primes are pairs of numbers (n, m)
such as n
and m
both are prime, and m = n + 6
.
You need to create a function which will take an integer, check for sexy primes from 0 to that integer, and return an array of arrays.
For example, listSexy(30)
must return [[5,11], [7,13], [11,17], [13,19], [17,23], [23,29]]
or some equivalent.
This is code-golf so the program with the shortest bytecount wins!
Can you explain what the desired output format looks like? – Howard – 2012-06-26T14:34:28.533
11Bah, I hate it when the challenge changes after answers have been submitted. – Griffin – 2012-06-26T15:25:53.907
2Is there a certain reason to check from 0? Why shouldn't I check from (5,11)? A short definition of sexy primes should be given right here, while linking to Wikipedia for further reading is welcome. – user unknown – 2012-06-27T14:45:02.267
1In Portuguese Sexy Primes translates to the same as Sexy Cousins! – sergiol – 2017-11-06T23:35:23.090