Coprime triplets: Difference between revisions
m
→{{header|Raku}}: How should we interpret ""Coprime triplets less than 50" I wonder?
(Add Factor) |
Thundergnat (talk | contribs) m (→{{header|Raku}}: How should we interpret ""Coprime triplets less than 50" I wonder?) |
||
Line 118:
state %seen = 1, True, 2, True;
state $min = 3;
my $n = ($min .. *).first: { !%seen{$_} && ($_ gcd $
%seen{$n} = True;
if %seen.elems %%
$n
} … *;
put "Coprime triplets
@coprime-triplets[^(@coprime-triplets.first: * > 50, :k)].batch(10)».fmt("%4d").join: "\n";
put "\
@coprime-triplets[
put "\nAnd for the heck of it: 1001th through 1050th Coprime triplet:\n",
@coprime-triplets[1000..1049].batch(10)».fmt("%4d").join: "\n";</lang>
{{out}}
<pre>Coprime triplets
1 2 3 5 4 7 9 8 11 13
6 17 19 10 21 23 16 15 29 14
Line 137 ⟶ 140:
47 20 33 49 26 45
Or maybe, minimum Coprime triplets that encompass 1 through 50:
1000th through 1025th Coprime triplet:▼
1 2 3 5 4 7 9 8 11 13
1355 682 1293 1361 680 1287 1363 686 1299 1367▼
6 17 19 10 21 23 16 15 29 14
688 1305 1369 692 1311 1373 694 1317 1375 698▼
25 27 22 31 35 12 37 41 18 43
1323 1381 704 1329 1379 706</pre>▼
47 20 33 49 26 45 53 28 39 55
32 51 59 38 61 63 34 65 57 44
67 69 40 71 73 24 77 79 30 83
89 36 85 91 46 75 97 52 81 95
56 87 101 50 93 103 58 99 107 62
105 109 64 111 113 68 115 117 74 119
121 48 125 127 42
712 1347 1391 700 1353 1399 710 1359 1393 718
1371 1397 722 1365 1403 724 1377 1405 728 1383</pre>
=={{header|REXX}}==
|