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.

Previous Showing 11-20 of 24 results. Next

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]

A302981 Number of ways to write n as x^2 + 2*y^2 + 2^z + 2^w, where x,y,z,w are nonnegative integers with z <= w.

Original entry on oeis.org

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

Views

Author

Zhi-Wei Sun, Apr 16 2018

Keywords

Comments

Clearly, a(2*n) > 0 if a(n) > 0. We note that 52603423 is the first value of n > 1 with a(n) = 0.
See also A302982 and A302983 for related things.

Examples

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

Crossrefs

Programs

  • Mathematica
    SQ[n_]:=SQ[n]=IntegerQ[Sqrt[n]];
    f[n_]:=f[n]=FactorInteger[n];
    g[n_]:=g[n]=Sum[Boole[MemberQ[{5,7},Mod[Part[Part[f[n],i],1],8]]&&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^k-2^j],Do[If[SQ[n-2^k-2^j-2x^2],r=r+1],{x,0,Sqrt[(n-2^k-2^j)/2]}]],{k,0,Log[2,n]-1},{j,k,Log[2,Max[1,n-2^k]]}];tab=Append[tab,r],{n,1,60}];Print[tab]

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

Original entry on oeis.org

0, 0, 0, 1, 2, 2, 4, 5, 4, 5, 6, 4, 8, 8, 7, 12, 8, 6, 9, 9, 6, 13, 13, 8, 13, 12, 8, 13, 14, 11, 15, 17, 8, 14, 11, 11, 16, 17, 11, 17, 19, 8, 17, 19, 10, 19, 18, 12, 15, 17, 12, 20, 17, 13, 20, 18, 16, 24, 18, 15
Offset: 1

Views

Author

Zhi-Wei Sun, Apr 16 2018

Keywords

Comments

Conjecture: a(n) > 0 for all n > 3.
Clearly, a(2*n) > 0 if a(n) > 0. We have verified a(n) > 0 for all n = 4..6*10^9.
See also A302982 and A302984 for similar conjectures.

Examples

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

Crossrefs

Programs

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

A302985 Number of ordered pairs (x, y) of nonnegative integers such that n - 2^x - 3*2^y has the form u^2 + 2*v^2 with u and v integers.

Original entry on oeis.org

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

Views

Author

Zhi-Wei Sun, Apr 16 2018

Keywords

Comments

Conjecture: a(n) > 0 for all n > 3.
This is equivalent to the author's conjecture in A302983. We have verified a(n) > 0 for all n = 4...6*10^9.
See also A302982 and A302984 for similar conjectures.

Examples

			a(4) = 1 with 4 - 2^0 - 3*2^0 = 0^2 + 2*0^2.
a(5) = 2 with 5 - 2^0 - 3*2^0 = 1^2 + 2*0^2 and 5 - 2^1 - 3*2^0 = 0^2 + 2*0^2.
a(6) = 2 with 6 - 2^0 - 3*2^0 = 0^2 + 2*1^2 and 6 - 2^1 - 3*2^0 = 1^2 + 2*0^2.
		

Crossrefs

Programs

  • Mathematica
      f[n_]:=f[n]=FactorInteger[n];
    g[n_]:=g[n]=Sum[Boole[MemberQ[{5,7},Mod[Part[Part[f[n],i],1],8]]&&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-3*2^k-2^j],r=r+1],{k,0,Log[2,n/3]},{j,0,If[3*2^k==n,-1,Log[2,n-3*2^k]]}];tab=Append[tab,r],{n,1,60}];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]

A303235 Number of ordered pairs (x, y) with 0 <= x <= y such that n - 2^x - 2^y can be written as the sum of two triangular numbers.

Original entry on oeis.org

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

Views

Author

Zhi-Wei Sun, Apr 20 2018

Keywords

Comments

Conjecture: a(n) > 0 for all n > 1.
Note that a nonnegative integer m is the sum of two triangular numbers if and only if 4*m+1 (or 8*m+2) can be written as the sum of two squares.
We have verified a(n) > 0 for all n = 2..4*10^8. See also the related sequences A303233 and A303234.

Examples

			a(2) = 1 with 2 - 2^0 - 2^0 = 0*(0+1)/2 + 0*(0+1)/2.
a(3) = 2 with 3 - 2^0 - 2^0 = 0*(0+1)/2 + 1*(1+1)/2 and 3 - 2^0 - 2^1 = 0*(0+1)/2 + 0*(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],4]==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]);
    tab={};Do[r=0;Do[If[QQ[4(n-2^k-2^j)+1],r=r+1],{k,0,Log[2,n]-1},{j,k,Log[2,n-2^k]}];tab=Append[tab,r],{n,1,60}];Print[tab]
Previous Showing 11-20 of 24 results. Next