Sum of two adjacent numbers are primes: Difference between revisions

m
J: simplify
(J)
m (J: simplify)
Line 139:
Here, we generate the first 20 odd primes, divide by 2, drop the fractional part and add 0 and 1 to that value. Then we format that pair of numbers with their sum and with decorations indicating the relevant arithmetic:
 
<lang J> (+/,&":'=',{.,&":'+',&":{:)"#. 0 1+/~<.@-: p:1+i.20
3=1+2
5=2+3
6,962

edits