Ruth-Aaron numbers: Difference between revisions
Content added Content deleted
m (→{{header|Wren}}: Changed to Wren S/H) |
(Add Mathematica/Wolfram Language implementation) |
||
Line 941: | Line 941: | ||
Ruth Aaron factor triple starts at: 417162 |
Ruth Aaron factor triple starts at: 417162 |
||
</pre> |
|||
=={{header|Mathematica}}/{{header|Wolfram Language}}== |
|||
{{trans|Julia}} |
|||
<syntaxhighlight lang="Mathematica"> |
|||
SumPrimeDivisors[n_] := Total[First /@ FactorInteger[n]] |
|||
RuthAaron[n_] := SumPrimeDivisors[n] == SumPrimeDivisors[n + 1] |
|||
SumPrimeFactors[n_] := |
|||
Total[First[#] * Last[#] & /@ FactorInteger[n]] |
|||
RuthAaronFactors[n_] := |
|||
SumPrimeFactors[n] == SumPrimeFactors[n + 1] |
|||
RuthAaronSeq := Select[Range[100000], RuthAaron] |
|||
RuthAaronFactorSeq := Select[Range[100000], RuthAaronFactors] |
|||
Print["30 Ruth Aaron numbers:"] |
|||
Print[Take[RuthAaronSeq, 30]] |
|||
Print["\n30 Ruth Aaron factor numbers:"] |
|||
Print[Take[RuthAaronFactorSeq, 30]] |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
30 Ruth Aaron numbers: |
|||
{5, 24, 49, 77, 104, 153, 369, 492, 714, 1682, 2107, 2299, 2600, 2783, 5405, 6556, 6811, 8855, 9800, 12726, 13775, 18655, 21183, 24024, 24432, 24880, 25839, 26642, 35456, 40081} |
|||
30 Ruth Aaron factor numbers: |
|||
{5, 8, 15, 77, 125, 714, 948, 1330, 1520, 1862, 2491, 3248, 4185, 4191, 5405, 5560, 5959, 6867, 8280, 8463, 10647, 12351, 14587, 16932, 17080, 18490, 20450, 24895, 26642, 26649} |
|||
</pre> |
</pre> |
||