Pairs with common factors: Difference between revisions

(J draft)
Line 89:
 
=={{header|J}}==
For this task, because of the summation of euler totient values, it's more efficient to generate the sequence with a slightly different routine than we would use to compute a single value. Thus:<lang J> (-:@(*1 <:)_1r2 + 11r2&p. - +/\@:(5&p:)) 1+i.1e2
0 0 0 1 1 4 4 7 9 14 14 21 21 28 34 41 41 52 52 63 71 82 82 97 101 114 122 137 137 158 158 173 185 202 212 235 235 254 268 291 291 320 320 343 363 386 386 417 423 452 470 497 497 532 546 577 597 626 626 669 669 700 726 757 773 818 818 853 877 922 922 969 969 1006 1040 1079 1095 1148 1148 1195 1221 1262 1262 1321 1341 1384 1414 1461 1461 1526 1544 1591 1623 1670 1692 1755 1755 1810 1848 1907
(-:@(*1 <:)_1r2 1r2&p.@{: + 1 - +/@:(5&p:)) 1+i.1e3
195309
(-:@(*1 <:)_1r2 1r2&p.@{: + 1 - +/@:(5&p:)) 1+i.1e4
1.95975e7
(-:@(* <:)@{: + 1 - +/@:(5&p:)) x:1+i.1e4
19597515
(-:@(*1 _1r2 <:)1r2&p.@{: + 1 - +/@:(5&p:)) x:1+i.1e5
1960299247
(-:@(*1 _1r2 <:)1r2&p.@{: + 1 - +/@:(5&p:)) x:1+i.1e6
196035947609</lang>
 
=={{header|Phix}}==
<!--<lang Phix>(phixonline)-->
6,962

edits