login
This site is supported by donations to The OEIS Foundation.
Logo

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A100559 Smallest prime equal to the sum of n distinct squares. 0
5, 29, 71, 79, 131, 179, 269, 349, 457, 569, 719, 971, 1171, 1327, 1601, 1913, 2269, 2593, 2999, 3539, 4099, 4549, 5231, 5717, 6529, 7297, 7879, 8779, 9791, 10711, 11867, 12809, 14081, 15269, 16561, 17863, 19463, 20771, 22541, 24329, 25913 (list; graph; refs; listen; history; internal format)
OFFSET

2,1

COMMENTS

The Mathematica code uses backtracking to find the least prime for each n. The Print command may be uncommented to show the sum that produces the prime. - T. D. Noe (noe(AT)sspectra.com), Jan 04 2005

EXAMPLE

a(3)=29 because 29=2^2+3^2+4^2;

a(4) = 71 = 1^2+3^2+5^2+6^2

a(5)=79 because 79=1^2+2^2+3^2+4^2+7^2.

MATHEMATICA

$RecursionLimit=1000; try2[lev_] := Module[{t, j, ss}, ss=Plus@@(Take[soln, lev-1]^2); If[lev>n, If[ss<=minPrime&&PrimeQ[ss], minPrime=ss; bestSoln={ss, soln}], If[lev==1, t=1, t=soln[[lev-1]]+1]; j=t; While[ss+Sum[(j+i)^2, {i, 0, n-lev}] <= minPrime, soln[[lev]]=j; try2[lev+1]; soln[[lev]]=t; j++ ]]]; Table[minPrime=Infinity; bestSoln={}; soln=Table[1, {n}]; try2[1]; (*Print[bestSoln]; *) bestSoln[[1]], {n, 2, 50}] (T. D. Noe)

CROSSREFS

Sequence in context: A108928 A097812 A176333 * A087348 A154412 A050409

Adjacent sequences:  A100556 A100557 A100558 * A100560 A100561 A100562

KEYWORD

nonn,easy

AUTHOR

Giovanni Teofilatto (g.teofilatto(AT)tiscalinet.it), Jan 02 2005

EXTENSIONS

More terms from T. D. Noe (noe(AT)sspectra.com), Jan 04 2005

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
Recent Additions | More pages | Superseeker | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified February 17 00:09 EST 2012. Contains 205978 sequences.