A269931 Integers n such that the sum of squares of the first n primes (A024450) is the sum of 4 but no fewer nonzero squares.
4, 12, 20, 28, 29, 36, 44, 49, 52, 57, 60, 68, 73, 76, 84, 92, 100, 105, 108, 116, 124, 132, 140, 148, 153, 156, 161, 164, 172, 180, 188, 189, 196, 201, 204, 212, 220, 228, 236, 244, 252, 260, 268, 276, 281, 284, 289, 292, 300, 308, 316, 324, 329, 332, 340, 345, 348, 356, 364, 372
Offset: 1
Keywords
Examples
4 is a term because 2^2 + 3^2 + 5^2 + 7^2 = 87 and 87 = x^2 + y^2 + z^2 has no solution for integer x, y and z. 5 is not a term because 2^2 + 3^2 + 5^2 + 7^2 + 11^2 = 208 = 8^2 + 12^2.
Links
- Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
Select[Range@ 372, Nand[SquaresR[4, #] > 1, Or[SquaresR[3, #] > 1, SquaresR[2, #] > 1, IntegerQ@ Sqrt@ #]] &@ Total[Prime[Range@ #]^2] &] (* Michael De Vlieger, Mar 08 2016 *)
-
PARI
isA004215(n)= my(fouri, j) ; fouri=1 ; while( n >=7*fouri, if( n % fouri ==0, j= n/fouri-7 ; if( j % 8==0, return(1) ) ; ); fouri *= 4 ; ) ; return(0) ; a024450(n) = sum(k=1, n, prime(k)^2); for(n=1, 1e3, if(isA004215(a024450(n)), print1(n, ", ")));
-
PARI
list(lim)=my(v=List(),n,s); forprime(p=2,, s+=p^2; if(n++>lim, return(Vec(v))); if(s\4^valuation(s, 4)%8==7, listput(v,n))) \\ Charles R Greathouse IV, Mar 08 2016
Comments