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 36 results. Next

A097268 Numbers that are both the sum of two nonzero squares and the difference of two nonzero squares.

Original entry on oeis.org

5, 8, 13, 17, 20, 25, 29, 32, 37, 40, 41, 45, 52, 53, 61, 65, 68, 72, 73, 80, 85, 89, 97, 100, 101, 104, 109, 113, 116, 117, 125, 128, 136, 137, 145, 148, 149, 153, 157, 160, 164, 169, 173, 180, 181, 185, 193, 197, 200, 205, 208, 212, 221, 225, 229, 232, 233
Offset: 1

Views

Author

Ray Chandler, Aug 19 2004

Keywords

Comments

Intersection of A000404 (sum of squares) and A024352 (difference of squares).
Also: Numbers of the form x^2+4y^2, where x and y are positive integers. Cf. A154777, A092572, A154778 for analogous sequences. - M. F. Hasler, Jan 24 2009

Crossrefs

Programs

  • PARI
    isA097268(n) = forstep( b=2,sqrtint(n-1),2, issquare(n-b^2) && return(1)) \\ M. F. Hasler, Jan 24 2009

A155716 Numbers of the form N = a^2 + 6b^2 for some positive integers a,b.

Original entry on oeis.org

7, 10, 15, 22, 25, 28, 31, 33, 40, 42, 49, 55, 58, 60, 63, 70, 73, 79, 87, 88, 90, 97, 100, 103, 105, 106, 112, 118, 121, 124, 127, 132, 135, 145, 150, 151, 154, 159, 160, 166, 168, 175, 177, 186, 193, 196, 198, 199, 202, 214, 217, 220, 223, 225, 231, 232, 240
Offset: 1

Views

Author

M. F. Hasler, Jan 25 2009

Keywords

Comments

Subsequence of A002481 (which allows for a and b to be zero).
Primes are in A033199. - Bernard Schott, Sep 20 2019

Crossrefs

Programs

  • Mathematica
    With[{upto=240},Select[Union[#[[1]]^2+6#[[2]]^2&/@Tuples[ Range[Sqrt[ upto]], 2]],#<=upto&]] (* Harvey P. Dale, Aug 05 2016 *)
  • PARI
    isA155716(n,/* optional 2nd arg allows us to get other sequences */c=6) = { for(b=1,sqrtint((n-1)\c), issquare(n-c*b^2) & return(1))}
    for( n=1,999, isA155716(n) & print1(n","))
    
  • PARI
    upto(n) = my(res=List()); for(i=1,sqrtint(n),for(j=1, sqrtint((n - i^2) \ 6), listput(res, i^2 + 6*j^2))); listsort(res,1); res \\ David A. Corneth, Sep 18 2019

A155578 Intersection of A000404 and A155717: N = a^2 + b^2 = c^2 + 7*d^2 for some positive integers a,b,c,d.

Original entry on oeis.org

8, 29, 32, 37, 53, 72, 109, 113, 116, 128, 137, 148, 149, 193, 197, 200, 212, 232, 233, 261, 277, 281, 288, 296, 317, 333, 337, 373, 389, 392, 400, 401, 421, 424, 436, 449, 452, 457, 464, 477, 512, 541, 548, 557, 569, 592, 596, 613, 617, 641, 648, 653, 673
Offset: 1

Views

Author

M. F. Hasler, Jan 25 2009

Keywords

Comments

Subsequence of A155568 (where a,b,c,d may be zero).

Crossrefs

Programs

  • PARI
    isA155578(n,/* optional 2nd arg allows us to get other sequences */c=[7,1]) = { for(i=1,#c, for(b=1,sqrtint((n-1)\c[i]), issquare(n-c[i]*b^2) & next(2)); return);1}
    for( n=1,999, isA155578(n) & print1(n","))
    
  • Python
    from math import isqrt
    def aupto(limit):
        cands = range(1, isqrt(limit)+1)
        left =  set(a**2 +   b**2 for a in cands for b in cands)
        right = set(c**2 + 7*d**2 for c in cands for d in cands)
        return sorted(k for k in left & right if k <= limit)
    print(aupto(673)) # Michael S. Branicky, Aug 29 2021

A155717 Numbers of the form N = a^2 + 7b^2 for some positive integers a,b.

Original entry on oeis.org

8, 11, 16, 23, 29, 32, 37, 43, 44, 53, 56, 64, 67, 71, 72, 77, 79, 88, 92, 99, 107, 109, 112, 113, 116, 121, 127, 128, 137, 144, 148, 149, 151, 161, 163, 172, 176, 179, 184, 191, 193, 197, 200, 203, 207, 211, 212, 224, 232, 233, 239, 253, 256, 259, 261, 263, 268
Offset: 1

Views

Author

M. F. Hasler, Jan 25 2009

Keywords

Comments

Subsequence of A020670 (which allows for a and b to be zero).
If N=a^2+7*b^2 is a term then 7*N=(7*b)^2+7*a^2 is also a term. Conversely,if 7*N is a term then N is a term. Example: N=56; N/7=8 is a term, N*7=7^2+7*7^2 is a term. Sequences A154777, A092572 and A154778 have the same property with 7 replaced by prime numbers 2,3 and 5 respectively. - Jerzy R Borysowicz, May 22 2020

Crossrefs

Programs

  • Mathematica
    Select[Range[300], Reduce[a>0 && b>0 && # == a^2 + 7b^2, {a, b}, Integers] =!= False&] (* Jean-François Alcover, Nov 17 2016 *)
  • PARI
    isA155717(n,/* optional 2nd arg allows us to get other sequences */c=7) = { for(b=1,sqrtint((n-1)\c), issquare(n-c*b^2) & return(1))}
    for( n=1,300, isA155717(n) & print1(n","))
    
  • Python
    def aupto(limit):
        cands = range(1, int(limit**.5)+2)
        nums = [a**2 + 7*b**2 for a in cands for b in cands]
        return sorted(set(k for k in nums if k <= limit))
    print(aupto(268)) # Michael S. Branicky, Aug 11 2021

A216451 Numbers which are simultaneously of the form x^2+y^2, x^2+2y^2, x^2+3y^2, x^2+7y^2, all with x>0, y>0.

Original entry on oeis.org

193, 337, 457, 673, 772, 1009, 1033, 1129, 1201, 1297, 1348, 1737, 1801, 1828, 1873, 2017, 2137, 2377, 2473, 2521, 2689, 2692, 2713, 2857, 3033, 3049, 3088, 3217, 3313, 3361, 3529, 3600, 3697, 3889, 4036, 4057, 4113, 4132, 4153, 4201, 4516, 4561, 4624, 4657
Offset: 1

Views

Author

V. Raman, Sep 07 2012

Keywords

Comments

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+2*b^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+3*b^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+7*b^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. Also the power of 2 should not be 1, if it can be written in the form a^2+7*b^2.

Crossrefs

Intersection of A001481, A002479, A003136 and A020670, omitting squares. See also A216500. - N. J. A. Sloane, Sep 11 2012

Programs

  • Mathematica
    nn = 4657; lim = Floor[Sqrt[nn]]; t1 = Select[Union[Flatten[Table[a^2 + b^2, {a, lim}, {b, lim}]]], # <= nn &]; t2 = Select[Union[Flatten[Table[a^2 + 2*b^2, {a, lim}, {b, lim/Sqrt[2]}]]], # <= nn &]; t3 = Select[Union[Flatten[Table[a^2 + 3*b^2, {a, lim}, {b, lim/Sqrt[3]}]]], # <= nn &]; t7 = Select[Union[Flatten[Table[a^2 + 7*b^2, {a, lim}, {b, lim/Sqrt[7]}]]], # <= nn &]; Intersection[t1, t2, t3, t7] (* T. D. Noe, Sep 08 2012 *)

Extensions

Definition clarified by N. J. A. Sloane, Sep 11 2012

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

A216503 a(n) = number of positive integers k such that n = x^2 + k*y^2 has a solution with x>0, y>0.

Original entry on oeis.org

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

Views

Author

V. Raman, Sep 07 2012

Keywords

Examples

			a(17) = 6 because
17 = 4^2 + 1*1^2.
17 = 3^2 + 2*2^2.
17 = 1^2 + 4*2^2.
17 = 3^2 + 8*1^2.
17 = 2^2 + 13*1^2.
17 = 1^2 + 16*1^2.
Therefore there are 6 different values of k for which 17 can be written in the form a^2 + k*b^2.
		

Crossrefs

Programs

  • Mathematica
    Table[cnt = 0; Do[b = 1; found = False; While[q = n - k*b^2; ! found && q > 0, If[IntegerQ[Sqrt[q]], cnt++; found = True]; b++], {k, n}]; cnt, {n, 100}] (* T. D. Noe, Sep 11 2012 *)
  • PARI
    for(n=1, 100, sol=0; for(k=1, n-1, for(x=1, n, if(issquare(n-k*x*x)&&n-k*x*x>0, sol++; break))); print1(sol", ")) /* V. Raman, Oct 16 2012 */

A216504 Number of values of k for which n can be written in the form a^2 + k*b^2, a >= 0, b >= 0, k > 0. a(n) = 0 if there are infinitely many such k.

Original entry on oeis.org

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

Views

Author

V. Raman, Sep 07 2012

Keywords

Comments

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+2*b^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+3*b^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+7*b^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. Also the power of 2 should not be 1, if it can be written in the form a^2+7*b^2.
a(n) = 0 if and only if n is a square. - Charles R Greathouse IV, Sep 11 2012

Crossrefs

Programs

  • Maple
    N:= 100: # for a(1)..a(N)
    m:= floor(sqrt(N)):
    V:= Vector(N,i->{}):
    for a from 0 to m do
      for b from 1 to m do
        for k from 1 to floor((N-a^2)/b^2) do
          x:= a^2 + k*b^2;
          V[x]:= V[x] union {k};
    od od od:
    for i from 1 to N do
      if issqr(i) then V[i]:=0 else V[i]:= nops(V[i]) fi
    od:
    convert(V,list); # Robert Israel, Mar 06 2025
  • PARI
    for(n=1, 100, sol=0; for(k=1, n, for(x=0, n, if(issquare(n-k*x*x)&&n-k*x*x>=0, sol++; break))); if(issquare(n), print1(0", "), print1(sol", "))) /* V. Raman, Oct 16 2012 */

A216505 Number of values of k for which n can be written in the form a^2+k*b^2, a > 0, b > 0, k >= 0.

Original entry on oeis.org

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

Views

Author

V. Raman, Sep 07 2012

Keywords

Crossrefs

Programs

  • Mathematica
    Table[cnt = 0; If[IntegerQ[Sqrt[n]], cnt++]; Do[b = 1; found = False; While[q = n - k*b^2; ! found && q > 0, If[IntegerQ[Sqrt[q]], cnt++; found = True]; b++], {k, n}]; cnt, {n, 100}] (* T. D. Noe, Sep 11 2012 *)
  • PARI
    for(n=1, 100, sol=0; for(k=0, n-1, for(x=1, n, if(issquare(n-k*x*x)&&n-k*x*x>0, sol++; break))); print1(sol", ")) /* V. Raman, Oct 16 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
Previous Showing 11-20 of 36 results. Next