Ruth-Aaron Pair

Author

Eric W. Weisstein
December 16, 2004

This notebook downloaded from http://mathworld.wolfram.com/notebooks/IntegerSequences/Ruth-AaronPair.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/Ruth-AaronPair.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Code

RuthAaronSum[n_]:=Plus@@(First/@FactorInteger[n])
RuthAaronSumWithMultiplicity[n_]:=Plus@@Flatten[Table[First[#],{Last[#]}]&/@FactorInteger[n]]

Example

FactorInteger/@{714,715}

RuthAaronSum/@{714,715}

Without Multiplicities

s=RuthAaronSum1/@Range[10^5];//Timing

(p=Position[Equal@@@Partition[s,2,1],True]//Flatten)//Timing

s[[p]]

With Multiplicities

(10^5)

s=RuthAaronSumWithMultiplicity/@Range[10^5];//Timing

(p=Position[Equal@@@Partition[s,2,1],True]//Flatten)//Timing

s[[p]]

N[Plus@@(1/p),30]

Length[p]

ListPlot[FoldList[Plus,0,1/p],PlotStyle->Red]

(10^6)

s=RuthAaronSumWithMultiplicity/@Range[10^6];//Timing

(p=Position[Equal@@@Partition[s,2,1],True]//Flatten);//Timing

N[Plus@@(1/p),30]

Length[p]

ListPlot[FoldList[Plus,0,1/p],PlotStyle->Red]

(10^7)

s=RuthAaronSumWithMultiplicity/@Range[10^7];//Timing

(p=Position[Equal@@@Partition[s,2,1],True]//Flatten);//Timing

N[Plus@@(1/p),30]

Table[Count[p,_?(#<10^n&)],{n,7}]

SequenceLimit[N[FoldList[Plus,0,1/p],1000]]

SequenceLimit[N[FoldList[Plus,0,1/Take[p,300]],1000]]

(10^8)

s=RuthAaronSumWithMultiplicity/@Range[10^8];//Timing

Timing[
With[{n=8},
s=Range[10^n];
Do[s[[i]]=RuthAaronSumWithMultiplicity[i],{i,10^n}];
]
]

p={};
Do[If[s[[i]]==s[[i+1]],AppendTo[p,i]],{i,10^8-1}];//Timing

p

Table[Count[p,_?(#<10^n&)],{n,8}]

SequenceLimit[N[FoldList[Plus,0,1/p],200]]

SequenceLimit[N[FoldList[Plus,0,1/p],250]]

SequenceLimit[N[FoldList[Plus,0,1/p],500]]

SequenceLimit[N[FoldList[Plus,0,1/p],1000]]

N[Plus@@(1/p),30]