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.

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]