Euler's Rule

Author

Eric W. Weisstein
May 3, 2004

This notebook downloaded from http://mathworld.wolfram.com/notebooks/NumberTheory/EulersRule.nb.

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

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

Code

prq[m_,n_]:={(2^m)((2^(n-m))+1)-1,(2^n)((2^(n-m))+1)-1,(2^(n+m))((((2^(n-m))+1))^2)-1}

Examples

Timing[mn=Select[Flatten[Table[{m,n},{n,500},{m,n-1}],1],PrimeQ/@And@@prq@@#&]]

Timing[mn=Select[Flatten[Table[{m,n},{n,1000},{m,n-1}],1],PrimeQ/@And@@prq@@#&]]

Timing[mn=Select[Flatten[Table[{m,n},{n,1000,1500},{m,n-1}],1],PrimeQ/@And@@prq@@#&]]

Timing[mn=Select[Flatten[Table[{m,n},{n,1500,2000},{m,n-1}],1],PrimeQ/@And@@prq@@#&]]

Timing[mn=Select[Flatten[Table[{m,n},{n,2000,2500},{m,n-1}],1],PrimeQ/@And@@prq@@#&]]

Timing[mn=Select[Flatten[Table[{m,n},{n,2500,3000},{m,n-1}],1],PrimeQ/@And@@prq@@#&]]

l=prq@@@mn

2^#[[1]]{Times@@Most[#[[2]]],Last[#[[2]]]}&/@Transpose[{Last/@mn,l}]