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 21-30 of 48 results. Next

A133692 Expansion of phi(-q) * phi(q^2) in powers of q where phi() is a Ramanujan theta function.

Original entry on oeis.org

1, -2, 2, -4, 2, 0, 4, 0, 2, -6, 0, -4, 4, 0, 0, 0, 2, -4, 6, -4, 0, 0, 4, 0, 4, -2, 0, -8, 0, 0, 0, 0, 2, -8, 4, 0, 6, 0, 4, 0, 0, -4, 0, -4, 4, 0, 0, 0, 4, -2, 2, -8, 0, 0, 8, 0, 0, -8, 0, -4, 0, 0, 0, 0, 2, 0, 8, -4, 4, 0, 0, 0, 6, -4, 0, -4, 4, 0, 0, 0, 0
Offset: 0

Views

Author

Michael Somos, Sep 20 2007

Keywords

Comments

Ramanujan theta functions: f(q) (see A121373), phi(q) (A000122), psi(q) (A010054), chi(q) (A000700).
a(n) is nonzero if and only if n is in A002479.

Examples

			G.f. = 1 - 2*q + 2*q^2 - 4*q^3 + 2*q^4 + 4*q^6 + 2*q^8 - 6*q^9 - 4*q^11 + ...
		

Crossrefs

Programs

  • Magma
    A := Basis( ModularForms( Gamma1(16), 1), 80); A[1] -2*A[2] +2*A[3] - 4*A[4] + 2*A[5] + 4*A[7]; /* Michael Somos, Aug 29 2014 */
  • Mathematica
    a[ n_] := If[ n < 1, Boole[n == 0], (-1)^n 2 DivisorSum[ n, KroneckerSymbol[ -2, #] &]]; (* Michael Somos, Oct 30 2015 *)
    a[ n_] := SeriesCoefficient[ EllipticTheta[ 4, 0, q] EllipticTheta[ 3, 0, q^2], {q, 0, n}]; (* Michael Somos, Aug 29 2014 *)
  • PARI
    {a(n) = if( n<1, n==0, (-1)^n * 2 * sumdiv(n, d, kronecker( -2, d)))};
    
  • PARI
    {a(n) = my(A); if ( n<0, 0, A = x * O(x^n); polcoeff( eta(x + A)^2 * eta(x^4 + A)^5 / (eta(x^2 + A)^3 * eta(x^8 + A)^2), n))};
    

Formula

Expansion of eta(q)^2 * eta(q^4)^5 / (eta(q^2)^3 * eta(q^8)^2) in powers of q.
Euler transform of period 8 sequence [ -2, 1, -2, -4, -2, 1, -2, -2, ...].
Moebius transform is period 16 sequence [ -2, 4, -2, 0, 2, 4, 2, 0, -2, -4, -2, 0, 2, -4, 2, 0, ...].
a(n) = -2 * b(n) where b(n) is multiplicative with b(2^e) = -1 if e>0, b(p^e) = (1 + (-1)^e) / 2 if p == 5, 7 (mod 8), b(p^e) = e + 1 if p == 1, 3 (mod 8).
G.f.: Product_{k>0} (1 - x^k)^2 * (1 + x^(2*k))^3 / (1 + x^(4*k))^2.
a(8*n + 5) = a(8*n + 7) = 0.
A133690 is the convolution square. a(n) = (-1)^n * A033715(n). a(2*n) = A033715(n). a(2*n + 1) = -2 * A113411(n).

A216501 Let S_k = {x^2+k*y^2: x,y positive integers}. How many out of S_1, S_2, S_3, S_7 does n belong to?

Original entry on oeis.org

0, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 2, 0, 0, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 2, 1, 2, 0, 2, 3, 1, 1, 1, 2, 0, 3, 2, 1, 0, 0, 2, 1, 1, 1, 2, 2, 1, 0, 1, 2, 1, 1, 0, 2, 0, 1, 2, 1, 1, 3, 2, 0, 0, 1, 3, 3, 1, 1, 2, 1, 0, 2, 1, 1, 2, 1, 1, 1, 1, 0, 2, 2, 1, 1, 1, 1, 0, 0, 1, 3, 1, 2, 2, 1, 1, 1, 1, 0, 1, 2, 2, 3, 0, 1, 2, 3, 1, 0, 2, 2, 1, 0, 0
Offset: 1

Views

Author

V. Raman, Sep 07 2012

Keywords

Comments

"If a composite number C is of the form a^2 + kb^2 for some integers a & b, then every prime factor P (of C) raised to an odd power is of the form c^2 + kd^2, for some integers c & d."
This statement is only true for k = 1, 2, 3. For k = 7, with the exception of the prime factor 2, the statement mentioned above is true.
A number can be written as a^2 + b^2 if and only if it has no prime factor congruent to 3 (mod 4) raised to an odd power.
A number can be written as a^2 + 2b^2 if and only if it has no prime factor congruent to 5 (mod 8) or 7 (mod 8) raised to an odd power.
A number can be written as a^2 + 3b^2 if and only if it has no prime factor congruent to 2 (mod 3) raised to an odd power.
A number can be written as a^2 + 7b^2 if and only if it has no prime factor congruent to 3 (mod 7) or 5 (mod 7) or 6 (mod 7) raised to an odd power and the exponent of 2 is not 1.

Crossrefs

Programs

  • PARI
    for(n=1, 100, sol=0; for(x=1, 100, if(issquare(n-x*x)&&n-x*x>0, sol++; break)); for(x=1, 100, if(issquare(n-2*x*x)&&n-2*x*x>0, sol++; break)); for(x=1, 100, if(issquare(n-3*x*x)&&n-3*x*x>0, sol++; break)); for(x=1, 100, if(issquare(n-7*x*x)&&n-7*x*x>0, sol++; break)); print1(sol", ")) /* V. Raman, Oct 16 2012 */

Formula

a(n) = 0 for almost all n. - Charles R Greathouse IV, Sep 14 2012

Extensions

Edited by N. J. A. Sloane, Sep 11 2012

A216671 Let S_k = {x^2+k*y^2: x,y nonnegative integers}. How many out of S_1, S_2, S_3, S_7 does n belong to?

Original entry on oeis.org

4, 2, 2, 4, 1, 1, 2, 3, 4, 1, 2, 2, 2, 0, 0, 4, 2, 2, 2, 1, 1, 1, 1, 1, 4, 1, 2, 2, 2, 0, 1, 3, 1, 2, 0, 4, 3, 1, 1, 1, 2, 0, 3, 2, 1, 0, 0, 2, 4, 2, 1, 2, 2, 1, 0, 1, 2, 1, 1, 0, 2, 0, 2, 4, 1, 1, 3, 2, 0, 0, 1, 3, 3, 1, 2, 2, 1, 0, 2, 1, 4, 2, 1, 1, 1, 1, 0, 2, 2, 1, 1, 1, 1, 0, 0, 1, 3, 2, 2, 4, 1, 1, 1, 1, 0, 1, 2, 2, 3, 0, 1, 2, 3, 1, 0, 2, 2, 1, 0, 0
Offset: 1

Views

Author

V. Raman, Sep 13 2012

Keywords

Comments

"If a composite number C is of the form a^2 + kb^2 for some integers a & b, then every prime factor of C raised to an odd power is of the form c^2 + kd^2 for some integers c & d."
This statement is only true for k = 1, 2, 3.
For k = 7, with the exception of the prime factor 2, the statement mentioned above is true.
A number can be written as a^2 + b^2 if and only if it has no prime factor congruent to 3 (mod 4) raised to an odd power.
A number can be written as a^2 + 2b^2 if and only if it has no prime factor congruent to 5 (mod 8) or 7 (mod 8) raised to an odd power.
A number can be written as a^2 + 3b^2 if and only if it has no prime factor congruent to 2 (mod 3) raised to an odd power.
A number can be written as a^2 + 7b^2 if and only if it has no prime factor congruent to 3 (mod 7) or 5 (mod 7) or 6 (mod 7) raised to an odd power, and the exponent of 2 is not 1.
Comment from N. J. A. Sloane, Sep 14 2012: S_1, S_2, S_3, S_7 are the first four quadratic forms with class number 1. (See Cox, for example.)

References

  • David A. Cox, Primes of the Form x^2 + n y^2, Wiley, 1989. - From N. J. A. Sloane, Sep 14 2012

Crossrefs

Programs

  • PARI
    for(n=1, 100, sol=0; for(x=0, 100, if(issquare(n-x*x)&&n-x*x>=0, sol++; break)); for(x=0, 100, if(issquare(n-2*x*x)&&n-2*x*x>=0, sol++; break)); for(x=0, 100, if(issquare(n-3*x*x)&&n-3*x*x>=0, sol++; break)); for(x=0, 100, if(issquare(n-7*x*x)&&n-7*x*x>=0, sol++; break)); print1(sol", ")) /* V. Raman, Oct 16 2012 */

Formula

The fraction of terms with a(n)>0 goes to zero as n increases. - Charles R Greathouse IV, Sep 11 2012

Extensions

Edited by N. J. A. Sloane, Sep 14 2012

A301479 Positive integers m such that m^3 cannot be written in the form x^2 + 2*y^2 + 3*2^z with x,y,z nonnegative integers.

Original entry on oeis.org

1, 53, 69, 71, 77, 87, 101, 103, 106, 117, 127, 133, 138, 142, 149, 159, 173, 174, 181, 191, 197, 199, 202, 206, 207, 212, 213, 221, 223, 229, 231, 234, 266, 269, 276, 277, 284, 293, 298, 309, 311, 325, 341, 346, 348, 351, 357, 362, 365, 373, 389, 398, 404, 412, 423, 424, 426, 429
Offset: 1

Views

Author

Zhi-Wei Sun, Mar 22 2018

Keywords

Comments

It seems that this sequence has infinitely many terms. In contrast, the author conjectured in A301471 and A301472 that any square greater than one can be written as x^2 + 2*y^2 + 3*2^z with x,y,z nonnegative integers.
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 since x^2 + 2*y^2 + 3*2^z > 1^3 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-3*2^k],Goto[aa]],{k,0,Log[2,m^3/3]}];tab=Append[tab,m];Label[aa],{m,1,429}];Print[tab]

A030207 Expansion of eta(q)^2 * eta(q^2) * eta(q^4) * eta(q^8)^2 in powers of q.

Original entry on oeis.org

1, -2, -2, 4, 0, 4, 0, -8, -5, 0, 14, -8, 0, 0, 0, 16, 2, 10, -34, 0, 0, -28, 0, 16, 25, 0, 28, 0, 0, 0, 0, -32, -28, -4, 0, -20, 0, 68, 0, 0, -46, 0, 14, 56, 0, 0, 0, -32, 49, -50, -4, 0, 0, -56, 0, 0, 68, 0, -82, 0, 0, 0, 0, 64, 0, 56, 62, 8, 0, 0, 0, 40, -142, 0, -50, -136, 0, 0, 0, 0, -11, 92, 158, 0, 0, -28, 0
Offset: 1

Views

Author

Keywords

Comments

Ramanujan theta functions: f(q) (see A121373), phi(q) (A000122), psi(q) (A010054), chi(q) (A000700).
Unique cusp form of weight 3 for congruence group Gamma_1(8). - Michael Somos, Aug 11 2011
Associated with permutations in Mathieu group M24 of shape (8)^2(4)(2)(1)^2.
For n nonzero, a(n) is nonzero if and only if n is in A002479.
Number 20 of the 74 eta-quotients listed in Table I of Martin (1996).

Examples

			G.f. = q - 2*q^2 - 2*q^3 + 4*q^4 + 4*q^6 - 8*q^8 - 5*q^9 + 14*q^11 - 8*q^12 + ...
		

Crossrefs

Programs

  • Magma
    Basis( CuspForms( Gamma1(8), 3), 100) [1]; /* Michael Somos, May 27 2014 */
  • Mathematica
    a[ n_] := SeriesCoefficient[ q QPochhammer[ q]^2 QPochhammer[ q^2] QPochhammer[ q^4] QPochhammer[ q^8]^2, {q, 0, n}]; (* Michael Somos, Aug 11 2011 *)
    a[ n_] := SeriesCoefficient[ (1/4) EllipticTheta[ 3, 0, q] EllipticTheta[ 4, 0, q]^2 EllipticTheta[ 3, 0, q^2] EllipticTheta[ 2, 0, q^2]^2, {q, 0, n}]; (* Michael Somos, May 17 2015 *)
    a[ n_] := SeriesCoefficient[ (-EllipticTheta[ 3, 0, q]^5 EllipticTheta[ 3, 0, q^2] + 3 EllipticTheta[ 3, 0, q]^3 EllipticTheta[ 3, 0, q^2]^3 - 2 EllipticTheta[ 3, 0, q] EllipticTheta[ 3, 0, q^2]^5) / 4, {q, 0, n}]; (* Michael Somos, May 17 2015 *)
  • PARI
    {a(n) = my(A); if( n<1, 0, n--; A = x * O(x^n); polcoeff( (eta(x + A) * eta(x^8 + A))^2 * eta(x^2 + A) * eta(x^4 + A), n))}; /* Michael Somos, May 28 2007 */
    
  • PARI
    {a(n) = my(A, p, e, x, y, a0, a1); if( n<1, 0, A = factor(n); prod( k=1, matsize(A)[1], [p, e] = A[k, ]; if( p==2, (-2)^e, p%8>4, if( e%2, 0, p^e), for( x=1, sqrtint(p\2), if( issquare( p - 2*x^2, &y), break)); y = 4*y^2 - 2*p; a0=1; a1=y; for( i=2, e, x = y*a1 - p^2*a0; a0=a1; a1=x); a1)))}; /* Michael Somos, Jun 13 2007 */
    
  • Sage
    CuspForms( Gamma1(8), 3, prec = 100).0; # Michael Somos, Aug 11 2011
    

Formula

Expansion of q * phi(q) * phi(-q)^2 * phi(q^2) * psi(q^4)^2 in powers of q where phi(), psi() are Ramanujan theta functions. - Michael Somos, May 28 2007
Expansion of (3 * phi(q)^3 * phi(q^2)^3 - 2 * phi(q) * phi(q^2)^5 - phi(q)^5 * phi(q^2)) / 4 in powers of q where phi() is a Ramanujan theta function. - Michael Somos, Jun 13 2007
Euler transform of period 8 sequence [-2, -3, -2, -4, -2, -3, -2, -6, ...]. - Michael Somos, May 28 2007
a(n) is multiplicative with a(2^e) = (-2)^e, a(p^e) = (1+(-1)^e)/2 * p^e if p == 5, 7 (mod 8), a(p^e) = a(p)*a(p^(e-1)) - p^2*a(p^(e-2)) if p == 1, 3 (mod 8) where a(p) = 4*x^2 -2*p and p = x^2 + 2*y^2. - Michael Somos, Jun 13 2007
G.f. is a period 1 Fourier series which satisfies f(-1 / (8 t)) = 512^(1/2) (t/i)^3 f(t) where q = exp(2 Pi i t). - Michael Somos, Jul 25 2007
G.f.: (1/2) * Sum_{u,v in Z} (u*u - 2*v*v) * x^(u*u + 2*v*v). - Michael Somos, Jun 14 2007
G.f.: x * Product_{k>0} (1 - x^k)^6 * (1 + x^k)^4 * (1 + x^(2*k))^3 * (1 + x^(4*k))^6. - Michael Somos, May 28 2007
a(8*n + 5) = a(8*n + 7) = 0. a(2*n) = -2*a(n). a(8*n + 1) = A128712(n). a(8*n + 3) = -2 * A128713(n).

A216282 Number of nonnegative solutions to the equation x^2 + 2*y^2 = n.

Original entry on oeis.org

1, 1, 1, 1, 0, 1, 0, 1, 2, 0, 1, 1, 0, 0, 0, 1, 1, 2, 1, 0, 0, 1, 0, 1, 1, 0, 2, 0, 0, 0, 0, 1, 2, 1, 0, 2, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 2, 0, 0, 2, 0, 0, 2, 0, 1, 0, 0, 0, 0, 1, 0, 2, 1, 1, 0, 0, 0, 2, 1, 0, 1, 1, 0, 0, 0, 0, 3, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 3, 1, 0, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 0, 1, 0, 0
Offset: 1

Views

Author

V. Raman, Sep 03 2012

Keywords

Comments

Records occur at 1, 9, 81, 297, 891, 1683, 5049, 15147, 31977, ... - Antti Karttunen, Aug 23 2017

Examples

			For n = 9, there are two solutions: 9 = 9^2 + 2*(0^2) = 1^2 + 2*(2^2), thus a(9) = 2.
For n = 81, there are three solutions: 81 = 9^2 + 2*(0^2) = 3^2 + 2*(6^2) = 7^2 + 2*(4^2), thus a(81) = 3.
For n = 65536, there is one solution: 65536 = 256^2 + 2*(0^2) = 65536 + 0, thus a(65536) = 1.
For n = 65537, there is one solution: 65537 = 255^2 + 2*(16^2) = 65205 + 512, thus a(65537) = 1.
		

Crossrefs

Cf. A002479 (positions of nonzeros), A097700 (of zeros).

Programs

  • Mathematica
    r[n_] := Reduce[x >= 0 && y >= 0 && x^2 + 2 y^2 == n, Integers];
    a[n_] := Which[rn = r[n]; rn === False, 0, Head[rn] === And, 1, Head[rn] === Or, Length[rn], True, -1];
    Table[a[n], {n, 1, 120}] (* Jean-François Alcover, Jun 24 2017 *)
  • Scheme
    (define (A216282 n) (cond ((< n 2) 1) (else (let loop ((k (- (A000196 n) (modulo (- n (A000196 n)) 2))) (s 0)) (if (< k 0) s (let ((x (/ (- n (* k k)) 2))) (loop (- k 2) (+ s (A010052 x))))))))) ;; Antti Karttunen, Aug 23 2017

Extensions

Examples from Antti Karttunen, Aug 23 2017

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]

A034030 Imprimitively represented by x^2+2y^2.

Original entry on oeis.org

0, 4, 8, 9, 12, 16, 18, 24, 25, 27, 32, 36, 44, 48, 49, 50, 54, 64, 68, 72, 75, 76, 81, 88, 96, 98, 99, 100, 108, 121, 128, 132, 136, 144, 147, 150, 152, 153, 162, 164, 169, 171, 172, 176, 192, 196, 198, 200, 204, 216, 225, 228
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Maple
    # Maple code for A002479, A057127, A034030-A034034 from N. J. A. Sloane, Apr 30 2015
    lis:={}; lisP:={}; lisI:={};
    M:=50; M2:=M^2;
    for x from 0 to M do
       x2:=x^2;
    for y from 0 to M do
       N:=x2+2*y^2;
    if N <= M2 then
       if gcd(x,y) = 1 then lisP:={op(lisP),N}; else lisI:={op(lisI),N} fi;
       lis:={op(lis),N};
    fi;
    od: od:
    lprint("lis");
    Lis:=sort(convert(lis,list));
    lprint("lisP");
    LisP:=sort(convert(lisP,list));
    lprint("lisI");
    LisI:=sort(convert(lisI,list));
    lprint("lisPnotI");
    LisPnotI:=sort(convert(lisP minus lisI, list));
    lprint("lisInotP");
    LisInotP:=sort(convert(lisI minus lisP,list));
    lprint("lisIandP");
    LisIandP:=sort(convert(lisI intersect lisP,list));
    lprint("liseither");
    Liseither:=sort(convert(lis minus (lisI intersect lisP),list));

Extensions

Corrected by N. J. A. Sloane, Apr 30 2015

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]

A034034 Numbers that are primitively or imprimitively represented by x^2+2y^2, but not both.

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 8, 11, 12, 16, 17, 19, 22, 24, 25, 32, 33, 34, 36, 38, 41, 43, 44, 48, 49, 50, 51, 57, 59, 64, 66, 67, 68, 72, 73, 75, 76, 82, 83, 86, 88, 89, 96, 97, 98, 100, 102, 107, 108, 113, 114, 118, 123, 128, 129, 131
Offset: 1

Views

Author

Keywords

Crossrefs

Extensions

Corrected by N. J. A. Sloane, Apr 30 2015
Previous Showing 21-30 of 48 results. Next