Sum of two adjacent numbers are primes: Difference between revisions

added Arturo
(added Arturo)
Line 168:
20 : 36 + 37 = 73
</pre>
 
=={{header|Arturo}}==
 
<syntaxhighlight lang="arturo">loop.with:'i
select.first:20 1..∞ 'x -> prime? x + x+1
'x -> print [
(pad to :string i+1 2)++":"
(pad to :string x 2) "+" (pad.right to :string x+1 2) "=" x + x+1
]</syntaxhighlight>
 
{{out}}
 
<pre> 1: 1 + 2 = 3
2: 2 + 3 = 5
3: 3 + 4 = 7
4: 5 + 6 = 11
5: 6 + 7 = 13
6: 8 + 9 = 17
7: 9 + 10 = 19
8: 11 + 12 = 23
9: 14 + 15 = 29
10: 15 + 16 = 31
11: 18 + 19 = 37
12: 20 + 21 = 41
13: 21 + 22 = 43
14: 23 + 24 = 47
15: 26 + 27 = 53
16: 29 + 30 = 59
17: 30 + 31 = 61
18: 33 + 34 = 67
19: 35 + 36 = 71
20: 36 + 37 = 73</pre>
 
=={{header|AWK}}==
1,532

edits