cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-10 of 12 results. Next

A301376 Number of ways to write n^2 as x^2 + y^2 + z^2 + w^2 with x,y,z,w nonnegative integers and z <= w such that x^2-(3*y)^2 = 4^k for some k = 0,1,2,....

Original entry on oeis.org

1, 1, 2, 1, 1, 3, 1, 1, 4, 2, 2, 3, 3, 3, 3, 1, 5, 6, 2, 2, 10, 5, 4, 3, 2, 7, 7, 3, 5, 4, 3, 1, 12, 8, 2, 6, 4, 5, 10, 2, 7, 13, 8, 5, 10, 6, 6, 3, 8, 4, 7, 7, 8, 11, 4, 3, 17, 9, 5, 4, 8, 5, 9, 1, 8, 14, 8, 8, 13, 5, 8, 6, 11, 10, 7, 5, 13, 15, 7, 2
Offset: 1

Views

Author

Zhi-Wei Sun, Mar 19 2018

Keywords

Comments

Conjecture: a(n) > 0 for all n > 0. Moreover, any positive square n^2 can be written as x^2 + y^2 + z^2 + w^2 with x,y,z,w integers and y even such that x^2 - (3*y)^2 = 4^k for some k = 0,1,2,....
We have verifed this for all n = 1..10^7.
Compare this conjecture with the conjectures in A299537.
As 3*A001353(n)^2 + 1 = A001075(n)^2, the conjecture in A300441 implies that any positive square can be written as x^2 + y^2 + z^2 + w^2 with x,y,z,w integers such that x^2 - 3*y^2 = 4^k for some k = 0,1,2,....
See also A301391 for a similar conjecture.

Examples

			a(1) = 1 since 1^2 = 1^2 + 0^2 + 0^2 + 0^2 with 1^2 - (3*0)^2 = 4^0.
a(5) = 1 since 5^2 = 4^2 + 0^2 + 0^2 + 3^2 with 4^2 - (3*0)^2 = 4^2.
a(7) = 1 since 7^2 = 2^2 + 0^2 + 3^2 + 6^2 with 2^2 - (3*0)^2 = 4^1.
a(31) = 3 since 31^2 = 10^2 + 2^2 + 4^2 + 29^2 with 10^2 - (3*2)^2 = 4^3, and 31^2 = 20^2 + 4^2 + 4^2 + 23^2 = 20^2 + 4^2 + 16^2 + 17^2 with 20^2 - (3*4)^2 = 4^4.
		

Crossrefs

Programs

  • Mathematica
    f[n_]:=f[n]=FactorInteger[n];
    g[n_]:=g[n]=Sum[Boole[Mod[Part[Part[f[n],i],1]-3,4]==0&&Mod[Part[Part[f[n],i],2],2]==1],{i,1,Length[f[n]]}]==0;
    QQ[n_]:=QQ[n]=n==0||(n>0&&g[n]);
    SQ[n_]:=SQ[n]=IntegerQ[Sqrt[n]];
    tab={};Do[r=0;Do[If[SQ[4^k+9y^2]&&QQ[n^2-4^k-10y^2],Do[If[SQ[n^2-(4^k+10y^2)-z^2],r=r+1],{z,0,Sqrt[(n^2-4^k-10y^2)/2]}]],{k,0,Log[2,n]},{y,0,Sqrt[(n^2-4^k)/10]}];tab=Append[tab,r],{n,1,80}];Print[tab]

A301391 Number of ways to write n^2 as x^2 + y^2 + z^2 + w^2 with x,y,z,w nonnegative integers and y even such that x^2 - (6*y)^2 = 4^k for some k = 0,1,2,....

Original entry on oeis.org

1, 1, 2, 1, 1, 2, 1, 1, 4, 1, 1, 2, 1, 1, 2, 1, 3, 4, 1, 1, 8, 2, 2, 2, 3, 2, 6, 1, 2, 2, 1, 1, 11, 3, 2, 4, 4, 3, 3, 1, 6, 10, 6, 2, 7, 2, 3, 2, 6, 3, 8, 2, 7, 7, 2, 1, 11, 4, 4, 2, 2, 1, 6, 1, 3, 11, 3, 3, 16, 3, 5, 4, 8, 5, 2, 3, 11, 5, 8, 1
Offset: 1

Views

Author

Zhi-Wei Sun, Mar 20 2018

Keywords

Comments

Conjecture: a(n) > 0 for all n > 0, and a(n) = 1 only for n = 11, 13, 19, 2^k*m (k = 0,1,2,... and m = 1, 5, 7, 31).
We have verified a(n) > 0 for all n = 1..10^7.
See also A301376 for a similar conjecture.

Examples

			a(2) = 1 since 2^2 = 2^2 + 0^2 + 0^2 + 0^2 with 2^2 - (6*0)^2 = 4^1.
a(5) = 1 since 5^2 = 4^2 + 0^2 + 0^2 + 3^2 with 4^2 - (6*0)^2 = 4^2.
a(7) = 1 since 7^2 = 2^2 + 0^2 + 3^2 + 6^2 with 2^2 - (6*0)^2 = 4^1.
a(11) = 1 since 11 = 2^2 + 0^2 + 6^2 + 9^2 with 2^2 - (6*0)^2 = 4^1.
a(13) = 1 since 13 = 4^2 + 0^2 + 3^2 + 12^2 with 4^2 - (6*0)^2 = 4^2.
a(19) = 1 since 19 = 1^2 + 0^2 + 6^2 + 18^2 with 1^2 - (6*0)^2 = 4^0.
a(31) = 1 since 31^2 = 20^2 + 2^2 + 14^2 + 19^2 with 20^2 - (6*2)^2 = 4^4.
a(75) = 2 since 75^2 = 68^2 + 10^2 + 1^2 + 30^2 = 68^2 + 10^2 + 15^2 + 26^2 with 68^2 - (6*10)^2 = 4^5.
		

Crossrefs

Programs

  • Mathematica
    f[n_]:=f[n]=FactorInteger[n];
    g[n_]:=g[n]=Sum[Boole[Mod[Part[Part[f[n],i],1]-3,4]==0&&Mod[Part[Part[f[n],i],2],2]==1],{i,1,Length[f[n]]}]==0;
    QQ[n_]:=QQ[n]=n==0||(n>0&&g[n]);
    SQ[n_]:=SQ[n]=IntegerQ[Sqrt[n]];
    tab={};Do[r=0;Do[If[SQ[4^k+144m^2]&&QQ[n^2-4^k-148m^2], Do[If[SQ[n^2-(4^k+148m^2)-z^2],r=r+1],{z,0,Sqrt[(n^2-4^k-148m^2)/2]}]],{k,0,Log[2,n]},{m,0,Sqrt[(n^2-4^k)/148]}];tab=Append[tab,r],{n,1,80}];Print[tab]

A301471 Number of ways to write n^2 as x^2 + 2*y^2 + 3*2^z with x,y,z nonnegative integers.

Original entry on oeis.org

0, 1, 2, 1, 3, 4, 3, 1, 5, 4, 4, 4, 5, 4, 10, 1, 4, 7, 4, 4, 10, 4, 3, 4, 6, 6, 11, 4, 7, 10, 6, 1, 9, 5, 7, 7, 7, 6, 12, 4, 6, 12, 7, 4, 14, 4, 8, 4, 3, 8, 10, 6, 8, 13, 6, 4, 16, 8, 7, 10, 7, 6, 14, 1, 7, 11, 6, 5, 16, 9, 5, 7, 7, 7, 18, 6, 7, 14, 6, 4
Offset: 1

Views

Author

Zhi-Wei Sun, Mar 21 2018

Keywords

Comments

Square Conjecture: a(n) > 0 for all n > 1. Moreover, for any integer n > 3 we can write n^2 as x^2 + 2*y^2 + 3*2^z, where x,y,z are nonnegative integers with y even and z > 1.
It is known that a positive integer n has the form x^2 + 2*y^2 with x and y integers if and only if the p-adic order of n is even for any prime p == 5 or 7 (mod 8).
See also A301472 for the list of positive integers not of the form x^2 + 2*y^2 + 3*2^z with x,y,z nonnegative integers.
If n^2 = x^2 + 2*y^2 + 3*2^z with x,y,z nonnegative integers, then it is easy to see that x is not divisible by 3.
The Square Conjecture implies that for each n = 1,2,3,... we can write 3*n^2 as x^2 + 2*y^2 + 2^z with x,y,z nonnegative integers. In fact, if (3*n)^2 = u^2 + 2*v^2 + 3*2^z with u,v,z integers and z >= 0, then u^2 == v^2 (mod 3) and thus we may assume u == v (mod 3) without loss of generality, hence 3*n^2 = (u^2+2*v^2)/3 + 2^z = x^2 + 2*y^2 + 2^z with x = (u+2*v)/3 and y = (u-v)/3 integers.
On March 25, 2018 Qing-Hu Hou at Tianjin Univ. finished his verification of the Square Conjecture for n <= 4*10^8. Then I used Hou's program to verify the conjecture for n <= 5*10^9. - Zhi-Wei Sun, Apr 10 2018
I have found a counterexample to the Square Conjecture, namely a(5884015571) = 0. Note that 5884015571 is the product of the three primes 7, 17 and 49445509. - Zhi-Wei Sun, Apr 15 2018

Examples

			a(2) = 1 with 2^2 = 1^2 + 2*0^2 + 3*2^0.
a(3) = 2 with 3^2 = 2^2 + 2*1^2 + 3*2^0 = 1^2 + 2*1^2 + 3*2^1.
a(4) = 1 with 4^2 = 2^2 + 2*0^2 + 3*2^2.
a(1131599953) = 1 with 1131599953^2 = 316124933^2 + 2*768304458^2 + 3*2^6.
a(5884015571) = 0 since there are no nonnegative integers x,y,z such that  x^2 + 2*y^2 + 3*2^z = 5884015571^2.
		

Crossrefs

Programs

  • Mathematica
    f[n_]:=f[n]=FactorInteger[n];
    g[n_]:=g[n]=Sum[Boole[(Mod[Part[Part[f[n],i],1],8]==5||Mod[Part[Part[f[n],i],1],8]==7)&&Mod[Part[Part[f[n],i],2],2]==1],{i,1,Length[f[n]]}]==0;
    QQ[n_]:=QQ[n]=(n==0)||(n>0&&g[n]);
    SQ[n_]:=SQ[n]=IntegerQ[Sqrt[n]];
    tab={};Do[r=0;Do[If[QQ[n^2-3*2^k],Do[If[SQ[n^2-3*2^k-2x^2],r=r+1],{x,0,Sqrt[(n^2-3*2^k)/2]}]],{k,0,Log[2,n^2/3]}];tab=Append[tab,r],{n,1,80}];Print[tab]

A301472 Positive integers not of the form x^2 + 2*y^2 + 3*2^z with x,y,z nonnegative integers.

Original entry on oeis.org

1, 2, 77, 154, 157, 173, 285, 308, 311, 314, 317, 346, 383, 397, 477, 493, 509, 557, 570, 616, 621, 634, 692, 701, 717, 727, 733, 757, 766, 794, 797, 877, 909, 954, 957, 986, 997, 1013, 1018, 1069, 1085, 1093, 1111, 1114, 1117, 1181, 1197, 1221, 1232, 1242, 1268, 1277, 1293
Offset: 1

Views

Author

Zhi-Wei Sun, Mar 21 2018

Keywords

Comments

It might seem that 1 is the only square in this sequence, but 5884015571^2 is also a term of this sequence.
See also A301471 for related information.
It is known that a positive integer n has the form x^2 + 2*y^2 with x and y integers if and only if the p-adic order of n is even for any prime p == 5 or 7 (mod 8).

Examples

			a(1) = 1 and a(2) = 2 since x^2 + 2*y^2 + 3*2^z > 2 for all x,y,z = 0,1,2,....
		

Crossrefs

Programs

  • Mathematica
    f[n_]:=f[n]=FactorInteger[n];
    g[n_]:=g[n]=Sum[Boole[(Mod[Part[Part[f[n],i],1],8]==5||Mod[Part[Part[f[n],i],1],8]==7)&&Mod[Part[Part[f[n],i],2],2]==1],{i,1,Length[f[n]]}]==0;
    QQ[n_]:=QQ[n]=(n==0)||(n>0&&g[n]);
    SQ[n_]:=SQ[n]=IntegerQ[Sqrt[n]];
    tab={};Do[Do[If[QQ[m-3*2^k],Goto[aa]],{k,0,Log[2,m/3]}];tab=Append[tab,m];Label[aa],{m,1,1293}];Print[tab]

A302920 Number of ways to write prime(n)^2 as x^2 + 2*y^2 + 3*2^z with x,y,z nonnegative integers.

Original entry on oeis.org

1, 2, 3, 3, 4, 5, 4, 4, 3, 7, 6, 7, 6, 7, 8, 8, 7, 7, 6, 5, 7, 6, 8, 6, 8, 7, 9, 9, 7, 6, 6, 9, 7, 5, 8, 5, 9, 9, 10, 10, 9, 14, 7, 5, 11, 8, 8, 11, 10, 10, 12, 10, 6, 12, 11, 10, 8, 9, 10, 11, 8, 7, 15, 5, 11, 8, 14, 10, 7, 10
Offset: 1

Views

Author

Zhi-Wei Sun, Apr 15 2018

Keywords

Comments

Conjecture: a(n) > 0 for all n > 0. In other words, for any prime p there are nonnegative integers x, y and z such that x^2 + 2*y^2 + 3*2^z = p^2.
As mentioned in A301471, for the composite number m = 5884015571 = 7*17*49445509 there are no nonnegative integers x,y,z such that x^2 + 2*y^2 + 3*2^z = m^2.

Examples

			a(1) = 1 with prime(1)^2 = 4 = 1^2 + 2*0^2 + 3*2^0.
a(2) = 2 with prime(2)^2 = 9 = 2^2 + 2*1^2 + 3*2^0 = 1^2 + 2*1^2 + 3*2^1.
		

Crossrefs

Programs

  • Mathematica
    p[n_]:=p[n]=Prime[n];
    SQ[n_]:=SQ[n]=IntegerQ[Sqrt[n]];
    f[n_]:=f[n]=FactorInteger[n];
    g[n_]:=g[n]=Sum[Boole[(Mod[Part[Part[f[n],i],1],8]==5||Mod[Part[Part[f[n],i],1],8]==7)&&Mod[Part[Part[f[n],i],2],2]==1],{i,1,Length[f[n]]}]==0;
    QQ[n_]:=QQ[n]=(n==0)||(n>0&&g[n]);
    tab={};Do[r=0;Do[If[QQ[p[n]^2-3*2^k],Do[If[SQ[p[n]^2-3*2^k-2x^2],r=r+1],{x,0,Sqrt[(p[n]^2-3*2^k)/2]}]],{k,0,Log[2,p[n]^2/3]}];tab=Append[tab,r],{n,1,70}];Print[tab]

A301452 Number of ways to write n^2 as m*4^k + x^2 + 2*y^2 with m in the set {2, 3} and k,x,y nonnegative integers.

Original entry on oeis.org

0, 2, 2, 2, 2, 5, 3, 2, 4, 4, 4, 5, 5, 5, 6, 2, 4, 6, 5, 4, 9, 5, 4, 5, 5, 7, 10, 5, 6, 7, 8, 2, 6, 6, 7, 6, 9, 7, 10, 4, 6, 12, 3, 5, 10, 5, 6, 5, 5, 8, 9, 7, 7, 12, 5, 5, 13, 9, 6, 7, 8, 10, 13, 2, 6, 8, 10, 6, 15, 9, 9, 6, 10, 9, 12, 7, 8, 13, 6, 4
Offset: 1

Views

Author

Zhi-Wei Sun, Mar 21 2018

Keywords

Comments

Conjecture: a(n) > 0 for all n > 1.
We call this the 2-3 conjecture. It is simialr to the author's 2-5 conjecture which states that A300510(n) > 0 for all n > 1.
We have verified that a(n) > 0 for all n = 2..5*10^7.
It is known that the number of ways to write a positive integer n as x^2 + 2*y^2 with x and y integers is twice the difference |{d > 0: d|n and d == 1,3 (mod 8)}| - |{d>0: d|n and d == 5,7 (mod 8)}|.

Examples

			a(2) = 2 since 2^2 = 2*4^0 + 0^2 + 2*1^2 and 2^2 = 3*4^0 + 1^2 + 2*0^2.
a(3) = 2 since 3^2 = 2*4^1 + 1^2 + 2*0^2 and 3^2 = 3*4^0 + 2^2 + 2*1^2.
a(5) = 2 since 5^2 = 2*4^1 + 3^2 + 2*2^2 and 5^2 = 3*4^0 + 2^2 + 2*3^2.
		

Crossrefs

Programs

  • Mathematica
    f[n_]:=f[n]=n/2^(IntegerExponent[n,2]);
    OD[n_]:=OD[n]=Divisors[f[n]];
    QQ[n_]:=QQ[n]=(n==0)||(n>0&&Sum[JacobiSymbol[-2,Part[OD[n],i]],{i,1,Length[OD[n]]}]!=0);
    SQ[n_]:=SQ[n]=IntegerQ[Sqrt[n]];
    tab={};Do[r=0;Do[If[QQ[n^2-m*4^k],Do[If[SQ[n^2-m*4^k-2x^2],r=r+1],{x,0,Sqrt[(n^2-m*4^k)/2]}]],{m,2,3},{k,0,Log[4,n^2/m]}];tab=Append[tab,r],{n,1,80}];Print[tab]

A301579 Least nonnegative integer k such that n^2 - 3*2^k can be written as x^2 + 2*y^2 with x and y integers, or -1 if no such k exists.

Original entry on oeis.org

-1, 0, 0, 2, 0, 0, 1, 4, 1, 0, 0, 2, 0, 0, 1, 6, 1, 0, 0, 2, 0, 2, 1, 4, 1, 0, 0, 2, 0, 3, 3, 8, 1, 0, 3, 2, 0, 0, 3, 4, 1, 0, 1, 4, 0, 0, 1, 6, 3, 0, 0, 2, 1, 0, 1, 4, 3, 0, 1, 5, 0, 5, 1, 10, 1, 0, 0, 2, 3, 0, 4, 4, 1, 2, 0, 2, 0, 0, 3, 6
Offset: 1

Views

Author

Zhi-Wei Sun, Mar 23 2018

Keywords

Comments

The Square Conjecture in A301471 implies that a(n) >= 0 for all n > 1.
It is known that a positive integer n has the form x^2 + 2*y^2 with x and y integers if and only if the p-adic order of n is even for any prime p == 5 or 7 (mod 8).
Numbers t such that a(t) = 0 are 2, 3, 5, 6, 10, 11, 13, 14, 18, 19, 21, 26, 27, 29, 34, 37, ... - Altug Alkan, Mar 26 2018

Examples

			a(1) = -1 since 1^2 - 3*2^k < 0 for all k = 0,1,2,....
a(31) = 3 since 31^2 - 3*2^3 = 17^2 + 2*18^2.
a(2^k) = 2*k - 2 for all k = 1,2,3,..., because (2^k)^2 - 3*2^(2*k-2) = (2^(k-1))^2 + 2*0^2, and (2^k)^2 - 3*2^j = 2^j*(2^(2*k-j) - 3) with 0 <= j < 2*k-2 cannot be written as x^2 + 2*y^2 with x and y integers.
		

Crossrefs

Programs

  • Mathematica
    f[n_]:=f[n]=FactorInteger[n];
    g[n_]:=g[n]=Sum[Boole[(Mod[Part[Part[f[n],i],1],8]==5||Mod[Part[Part[f[n],i],1],8]==7)&&Mod[Part[Part[f[n],i],2],2]==1],{i,1,Length[f[n]]}]==0;
    QQ[n_]:=QQ[n]=(n==0)||(n>0&&g[n]);
    tab={};Do[Do[If[QQ[n^2-3*2^k],tab=Append[tab,k];Goto[aa]],{k,0,Log[2,n^2/3]}];tab=Append[tab,-1];Label[aa],{n,1,80}];Print[tab]

A301640 Largest integer k such that n^2 - 3*2^k can be written as x^2 + 2*y^2 with x and y integers, or -1 if no such k exists.

Original entry on oeis.org

-1, 0, 1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 6, 7, 7, 7, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 8, 9, 9, 9, 9, 8, 9, 9, 7, 9, 7, 9, 9, 8, 9, 10, 10, 10, 10, 10, 10, 10, 9, 10, 10, 10, 9, 10, 10, 10
Offset: 1

Views

Author

Zhi-Wei Sun, Mar 25 2018

Keywords

Comments

Conjecture: a(n) > 0.6*log_2(log_2 n) for all n > 2, and also lim inf_{n->infinity} a(n)/(log n) = 0.
The author's Square Conjecture in A301471 would imply that a(n) >= 0 for all n > 1. We have verified that a(n) > 0.6*log_2(log_2 n) for all n = 3..4*10^9. For n = 2857932461, we have a(n) = 3 and 0.603 < a(n)/log_2(log_2 n) < 0.604.
It is known that a positive integer n has the form x^2 + 2*y^2 with x and y integers if and only if the p-adic order of n is even for any prime p == 5 or 7 (mod 8).

Examples

			a(2) = 0 since 2^2 - 3*2^0 = 1^2 + 2*0^2.
a(3) = 1 since 3^2 - 3*2^1 = 2^2 + 2*1^2.
a(5) = 3 since 5^2 - 3*2^3 = 1^2 + 2*0^2.
a(6434567) = 10 since 6434567^2 - 3*2^10 = 5921293^2 + 2*1780722^2.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local k,t;
        for k from floor(log[2](n^2/3)) by -1 to 0 do
           if g(n^2 - 3*2^k) then return k fi
        od;
        -1
    end proc:
    map(f, [$1..100]); # Robert Israel, Mar 26 2018
  • Mathematica
    f[n_]:=f[n]=FactorInteger[n];
    g[n_]:=g[n]=Sum[Boole[(Mod[Part[Part[f[n],i],1],8]==5||Mod[Part[Part[f[n],i],1],8]==7)&&Mod[Part[Part[f[n],i],2],2]==1],{i,1,Length[f[n]]}]==0;
    QQ[n_]:=QQ[n]=(n==0)||(n>0&&g[n]);
    tab={};Do[Do[If[QQ[n^2-3*2^(Floor[Log[2,n^2/3]]-k)],tab=Append[tab,Floor[Log[2,n^2/3]]-k];Goto[aa]],{k,0,Log[2,n^2/3]}];tab=Append[tab,-1];Label[aa],{n,1,70}];Print[tab]

A301534 Number of ways to write the n-th prime congruent to 7 modulo 12 as x^2 + 3*y^2 + 15*2^z with x,y,z nonnegative integers.

Original entry on oeis.org

0, 2, 3, 4, 5, 5, 2, 6, 6, 4, 7, 4, 9, 6, 6, 6, 7, 9, 5, 10, 3, 9, 7, 9, 8, 11, 9, 8, 10, 5, 8, 9, 4, 10, 7, 7, 7, 8, 7, 13, 8, 6, 6, 14, 7, 15, 3, 11, 8, 10, 8, 7, 7, 9, 6, 9, 7, 7, 10, 12, 6, 9, 4, 7, 10, 12, 12, 7, 13, 9, 12, 6, 7, 10, 5, 8, 7, 12, 12, 10
Offset: 1

Views

Author

Zhi-Wei Sun, Apr 16 2018

Keywords

Comments

Conjecture: a(n) > 0 for all n > 1. In other words, any prime p > 7 with p == 7 (mod 12) can be written as x^2 + 3*y^2 + 15*2^z with x,y,z nonnegative integers.
We have verified the conjecture for all primes p == 7 (mod 12) with 7 < p < 8*10^9.

Examples

			a(1) = 0 since 7 cannot be written as x^2 + 3*y^2 + 15*2^z with x,y,z nonnegative integers.
a(2) = 2 since the second prime congruent to 7 modulo 12 is 19 and 19 = 1^2 + 3*1^2 + 15*2^0 = 2^2 + 3*0^2 + 15*2^0.
		

Crossrefs

Programs

  • Mathematica
    p[n_]:=p[n]=Prime[n];
    SQ[n_]:=SQ[n]=IntegerQ[Sqrt[n]];
    f[n_]:=f[n]=FactorInteger[n];
    g[n_]:=g[n]=Sum[Boole[MemberQ[{2},Mod[Part[Part[f[n],i],1],3]]&&Mod[Part[Part[f[n],i],2],2]==1],{i,1,Length[f[n]]}]==0;
    QQ[n_]:=QQ[n]=n==0||(n>0&&g[n]);
    n=0;Do[If[Mod[p[m],12]!=7,Goto[aa]];n=n+1;r=0;Do[If[QQ[p[m]-15*2^k],Do[If[SQ[p[m]-15*2^k-3x^2],r=r+1],{x,0,Sqrt[(p[m]-15*2^k)/3]}]],{k,0,Log[2,p[m]/15]}];Print[n," ",r];Label[aa],{m,1,315}]

A302641 Number of nonnegative integers k such that n^2 - 3*2^k can be written as x^2 + 2*y^2 with x and y integers.

Original entry on oeis.org

0, 1, 2, 1, 3, 3, 3, 1, 3, 4, 4, 3, 4, 4, 5, 1, 4, 4, 4, 4, 5, 4, 3, 3, 6, 5, 5, 4, 5, 5, 5, 1, 4, 5, 6, 4, 5, 5, 6, 4, 5, 6, 6, 4, 7, 4, 7, 3, 3, 7, 4, 5, 6, 6, 5, 4, 7, 6, 6, 5, 6, 5, 6, 1, 7, 5, 6, 5, 7, 7, 4, 4, 6, 5, 8, 5, 6, 7, 5, 4
Offset: 1

Views

Author

Zhi-Wei Sun, Apr 10 2018

Keywords

Comments

The author's Square Conjecture in A301471 implies that a(n) > 0 for all n > 1.
We have a(2^n) = 1 for all n > 0. In fact, (2^n)^2 = (2^(n-1))^2 + 2*0^2 + 3*2^(2*n-2). If k > 2*n-2 then 3*2^k >= 6*2^(2*n-2) > (2^n)^2. If 0 <= k < 2*n-2, then 2*n-k is at least 3 and hence (2^n)^2 - 3*2^k = 2^k*(2^(2*n-k)-3) cannot be written as x^2 + 2*y^2 with x and y integers.

Examples

			a(2) = 1 with 2^2 = 1^2 + 2*0^2 + 3*2^0.
a(3) = 2 with 3^2 = 2^2 + 2*1^2 + 3*2^0 = 1^2 + 2*1^2 + 3*2^1.
a(2857932461) = 1 since 3 is the only nonnegative integer k such that 2857932461^2 - 3*2^k has the form x^2 + 2*y^2 with x and y integers.
a(4428524981) = 2 since 3 and 8 are the only nonnegative integers k such that 4428524981^2 - 3*2^k has the form x^2 + 2*y^2 with x and y integers.
a(4912451281) = 3 since 3, 6 and 7 are the only nonnegative integers k with 4428524981^2 - 3*2^k = x^2 + 2*y^2 for some integers x and y.
		

Crossrefs

Programs

  • Mathematica
    f[n_]:=f[n]=FactorInteger[n];
    g[n_]:=g[n]=Sum[Boole[(Mod[Part[Part[f[n],i],1],8]==5||Mod[Part[Part[f[n],i],1],8]==7)&&Mod[Part[Part[f[n],i],2],2]==1],{i,1,Length[f[n]]}]==0;
    QQ[n_]:=QQ[n]=(n==0)||(n>0&&g[n]);
    tab={};Do[r=0;Do[If[QQ[n^2-3*2^k],r=r+1],{k,0,Log[2,n^2/3]}];tab=Append[tab,r],{n,1,80}];Print[tab]
Showing 1-10 of 12 results. Next