Pairs with common factors: Difference between revisions
→{{header|Raku}}: well duh, don't have to reify ''all'' of the terms that aren't being displayed.
(Added Wren) |
Thundergnat (talk | contribs) (→{{header|Raku}}: well duh, don't have to reify ''all'' of the terms that aren't being displayed.) |
||
Line 55:
my \𝜑 = 0, |(1..*).hyper.map: -> \t { t × [×] t.&prime-factors.unique.map: { 1 - 1/$_ } }
my @pairs-with-common-factors = (1..*).map: &pair-count;
say "Number of pairs with common factors - first one hundred terms:\n"
~ @pairs-with-common-factors[^100].batch(10)».&comma».fmt("%6s").join("\n") ~ "\n";
for ^
{{out}}
<pre>Number of pairs with common factors - first one hundred terms:
Line 74 ⟶ 76:
1,544 1,591 1,623 1,670 1,692 1,755 1,755 1,810 1,848 1,907
First term: 0
Tenth term: 14
One hundredth term: 1,907
One hundred thousandth term: 1,960,299,247
One millionth term: 196,035,947,609</pre>
=={{header|Wren}}==
|