A264010 Number of ways to write n as x^2 + y*(y+1) + z*(z+1)/2, where x, y and z are nonnegative integers such that y or y+1 is prime, and z or z+1 is prime.
0, 0, 1, 1, 1, 1, 2, 2, 3, 1, 1, 4, 4, 2, 1, 5, 4, 3, 3, 1, 6, 5, 4, 4, 4, 3, 6, 5, 1, 6, 7, 5, 4, 7, 4, 4, 7, 3, 6, 5, 5, 5, 6, 5, 5, 6, 3, 6, 9, 2, 4, 10, 2, 4, 3, 5, 9, 8, 6, 3, 10, 5, 5, 4, 4, 9, 8, 5, 4, 8, 7, 8, 7, 2, 5, 10, 6, 3, 8, 4, 6, 8, 3, 10, 6, 7, 7, 6, 5, 5, 5, 2, 10, 10, 4, 4, 11, 6, 5, 6
Offset: 1
Keywords
Examples
a(5) = 1 since 5 = 0^2 + 1*2 + 2*3/2 with 2 prime. a(6) = 1 since 6 = 1^2 + 1*2 + 2*3/2 with 2 prime. a(10) = 1 since 10 = 1^2 + 2*3 + 2*3/2 with 2 prime. a(11) = 1 since 11 = 2^2 + 2*3 + 1*2/2 with 2 prime. a(15) = 1 since 15 = 0^2 + 3*4 + 2*3/2 with 3 prime. a(20) = 1 since 20 = 2^2 + 2*3 + 4*5/2 with 2 and 5 both prime. a(29) = 1 since 29 = 4^2 + 3*4 + 1*2/2 with 3 and 2 both prime. a(1125) = 1 since 1125 = 33^2 + 5*6 + 3*4/2 with 5 and 3 both prime.
Links
- Zhi-Wei Sun, Table of n, a(n) for n = 1..10000
- Zhi-Wei Sun, Mixed sums of squares and triangular numbers, Acta Arith. 127(2007), 103-113.
Programs
-
Mathematica
SQ[n_]:=SQ[n]=IntegerQ[Sqrt[n]] Do[r=0;Do[If[(PrimeQ[y]||PrimeQ[y+1])==False,Goto[aa]];Do[If[(PrimeQ[z]||PrimeQ[z+1])&&SQ[n-y(y+1)-z(z+1)/2],r=r+1],{z,1,(Sqrt[8(n-y(y+1))+1]-1)/2}];Label[aa];Continue,{y,1,(Sqrt[4n+1]-1)/2}];Print[n, " ", r];Continue, {n,1,100}]
Comments