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 14 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

A020668 Numbers of the form x^2 + 4*y^2.

Original entry on oeis.org

0, 1, 4, 5, 8, 9, 13, 16, 17, 20, 25, 29, 32, 36, 37, 40, 41, 45, 49, 52, 53, 61, 64, 65, 68, 72, 73, 80, 81, 85, 89, 97, 100, 101, 104, 109, 113, 116, 117, 121, 125, 128, 136, 137, 144, 145, 148, 149, 153, 157, 160, 164, 169, 173, 180, 181, 185, 193, 196, 197, 200, 205, 208
Offset: 1

Views

Author

Keywords

Comments

x^2 + 4y^2 has discriminant -16.
Numbers that can be expressed as both the sum of two squares and the difference of two squares; the intersection of sequences A001481 and A042965. - T. D. Noe, Feb 05 2003
A004531(n) is nonzero if and only if n is of the form x^2 + 4*y^2. - Michael Somos, Jan 05 2012
These are the sum of two squares that are congruent to 0 or 1 (mod 4), and thus that are also the difference of two squares. - Jean-Christophe Hervé, Oct 25 2015

Crossrefs

Cf. A001481, A004531, A042965, A097269. For primes see A002144.

Programs

  • Magma
    [n: n in [0..208] | NormEquation(4, n) eq true]; // Arkadiusz Wesolowski, May 11 2016
  • Mathematica
    Select[Range[0, 300], SquaresR[2, #] != 0 && Mod[#, 4] != 2&] (* Jean-François Alcover, May 13 2017 *)
  • PARI
    for(n=0, 1e3, if(if( n<1, n==0, 2 * qfrep([ 1, 0; 0, 4], n)[n]) != 0, print1(n, ", "))) \\ Altug Alkan, Oct 29 2015
    

Formula

Complement of A097269 in A001481. - Jean-Christophe Hervé, Oct 25 2015

A057653 Odd numbers of form x^2 + y^2.

Original entry on oeis.org

1, 5, 9, 13, 17, 25, 29, 37, 41, 45, 49, 53, 61, 65, 73, 81, 85, 89, 97, 101, 109, 113, 117, 121, 125, 137, 145, 149, 153, 157, 169, 173, 181, 185, 193, 197, 205, 221, 225, 229, 233, 241, 245, 257, 261, 265, 269, 277, 281, 289, 293, 305, 313, 317, 325, 333, 337
Offset: 1

Views

Author

N. J. A. Sloane, Oct 15 2000

Keywords

Comments

Numbers with only odd prime factors and such that all prime factors congruent to 3 modulo 4 occur to an even exponent. - Jean-Christophe Hervé, Oct 24 2015
Odd terms of A020668. - Altug Alkan, Nov 19 2015
Also one half of the numbers that are the sum of two odd squares (without multiplicity). See A097269 for twice the numbers. - Wolfdieter Lang, Jan 12 2017

Crossrefs

Odd members of A001481.
Odd members of A020668.
Complement of A084109 in 4k+1 numbers (A016813).
Cf. A016754 (odd squares), A097269.

Programs

  • Maple
    readlib(issqr): for n from 1 to 1001 by 2 do for k from 0 to floor(sqrt(n)) do if issqr(n-k^2) then printf(`%d,`,n); break fi; od:od:
  • Mathematica
    fQ[n_] := Length@ Catch@ Do[If[IntegerQ@ Sqrt[n - k^2], Throw[{k, Sqrt[n - k^2]}], Nothing], {k, Floor[Sqrt@ n]^2}] != 0; Select[Range[1, 340, 2], fQ] (* Michael De Vlieger, Nov 13 2015 *)
  • PARI
    isok(n)=my(f=factor(n)); for(i=1, #f[, 1], if(f[i, 2]%2 && f[i, 1]%4==3, return(0))); 1;
    for(n=1, 1e3, if(isok(n) && n%2==1, print1(n", "))) \\ Altug Alkan, Nov 13 2015
    
  • PARI
    for(n=0, 1e3, if(if( n<1, n==0, 2 * qfrep([ 1, 0; 0, 4], n)[n]) != 0 && n%2==1, print1(n, ", "))) \\ Altug Alkan, Nov 19 2015
    
  • Python
    from itertools import count, islice
    from sympy import factorint
    def A057653_gen(): # generator of terms
        return filter(lambda n:all(p & 3 != 3 or e & 1 == 0 for p, e in factorint(n).items()),count(1,2))
    A057653_list = list(islice(A057653_gen(),30)) # Chai Wah Wu, Jun 28 2022

Formula

n = odd square * {product of distinct primes == 1 (mod 4)}.
a(n) = A097269(n)/2. - Wolfdieter Lang, Jan 12 2017

Extensions

More terms from James Sellers, Oct 16 2000

A101412 Least number of odd squares that sum to n.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Aug 08 2009

Keywords

Examples

			a(13) = 5: 13 = 1+1+1+1+9.
		

Crossrefs

Programs

  • Maple
    A101412 := proc(n) local lsq; lsq := [seq((2*j+1)^2,j=0..floor((sqrt(n)-1)/2))] ; lsq := convert(lsq,set) ; a := n ; for p in combinat[partition](n) do if convert(p,set) minus lsq = {} then a := min(a,nops(p)) ; fi; od: a ; end: for n from 1 do printf("%d,\n",A101412(n)) ; od: # R. J. Mathar, Aug 08 2009
    # problem has optimal substructure:
    a:= proc(n) option remember; local r; r:= isqrt(n);
          `if`(r^2=n and irem(r, 2)=1, 1,
           min(seq(a(i)+a(n-i), i=1..n/2)))
        end:
    seq(a(n), n=1..120);  # Alois P. Heinz, Jan 31 2011
  • Mathematica
    a[n_] := a[n] = Module[{r}, r = Sqrt[n]; If[IntegerQ[r] && OddQ[r], 1, Min[Table[a[i]+a[n-i], {i, 1, Floor[n/2]}]]]]; Table[a[n], {n, 1, 105}] (* Jean-François Alcover, Mar 19 2014, after Alois P. Heinz *)
  • PARI
    a(n)={x=n-1;if(x%8>1,k=1+x%8);if(n%8==1,k=9;if(issquare(n)&&n%2==1,k=1));if(x%8==1,k=10;y=1;while(x>0,if(issquare(x)&&x%2==1,k=2);y=y+2;x=n-y^2));k;} \\ Jinyuan Wang, Jan 29 2019

Formula

From Jinyuan Wang, Jan 29 2019: (Start)
For n == 1 (mod 8), if n is a perfect square, a(n) = 1, otherwise a(n) = 9.
For n == 2 (mod 8), if n is a term in A097269, a(n) = 2, otherwise a(n) = 10.
For n == k (mod 8), k = 3,4,...,8, a(n) = k.
For positive integer x, a(72*x+42) = a(72*x+66) = 10. (End)

Extensions

More terms from R. J. Mathar, Aug 08 2009
More terms from Alois P. Heinz, Jan 30 2011

A263715 Nonnegative integers that are the sum or difference of two squares.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37, 39, 40, 41, 43, 44, 45, 47, 48, 49, 50, 51, 52, 53, 55, 56, 57, 58, 59, 60, 61, 63, 64, 65, 67, 68, 69, 71, 72, 73, 74, 75, 76, 77, 79, 80
Offset: 1

Views

Author

Jean-Christophe Hervé, Oct 24 2015

Keywords

Comments

Contains all integers that are not equal to 2 (mod 4) (they are of the form y^2 - x^2) and those of the form 4k+2 = 2*(2k+1) with the odd number 2k+1 equal to the sum of two squares (A057653).

Examples

			2 = 1^2 + 1^2, 3 = 2^2 - 1^2, 4 = 2^2 + 0^2, 5 = 2^2 + 1^2 = 3^2 - 2^2.
		

Crossrefs

Programs

  • Mathematica
    r[n_] := Reduce[n == x^2 + y^2, {x, y}, Integers] || Reduce[0 <= y <= x && n == x^2 - y^2, {x, y}, Integers]; Reap[Do[If[r[n] =!= False, Sow[n]], {n, 0, 80}]][[2, 1]] (* Jean-François Alcover, Oct 25 2015 *)
  • Python
    from itertools import count, islice
    from sympy import factorint
    def A263715_gen(): # generator of terms
        return filter(lambda n: n & 3 != 2 or all(p & 3 != 3 or e & 1 == 0 for p, e in factorint(n).items()),count(0))
    A263715_list = list(islice(A263715_gen(),30)) # Chai Wah Wu, Jun 28 2022

Formula

Union of A001481 (sums of two squares) and A042965 (differences of two squares).
Union of A042965 and 2*A057653 = A097269, with intersection of A042965 and A097269 = {}.
Union of A020668 (x^2+y^2 and a^2-b^2), A097269 (x^2+y^2, not a^2-b^2) and A263737 (not x^2+y^2, a^2-b^2).

A263737 Nonnegative integers that are the difference of two squares but not the sum of two squares.

Original entry on oeis.org

3, 7, 11, 12, 15, 19, 21, 23, 24, 27, 28, 31, 33, 35, 39, 43, 44, 47, 48, 51, 55, 56, 57, 59, 60, 63, 67, 69, 71, 75, 76, 77, 79, 83, 84, 87, 88, 91, 92, 93, 95, 96, 99, 103, 105, 107, 108, 111, 112, 115, 119, 120, 123, 124, 127, 129, 131, 132, 133, 135, 139, 140
Offset: 1

Views

Author

Jean-Christophe Hervé, Oct 25 2015

Keywords

Comments

Intersection of A022544 (not the sum of two squares) and A042965 (differences of two squares).
The sequence contains all 4k + 3 and no 4k + 2 integers, and some 4k (4*A022544) and 4k+1 (A084109) integers. First differences are thus 1, 2, 3 or 4, each occurring infinitely often.

Crossrefs

Programs

  • Mathematica
    rs[n_] := Reduce[n == x^2 + y^2, {x, y}, Integers]; rd[n_] := Reduce[0 <= y <= x && n == x^2 - y^2, {x, y}, Integers]; Reap[Do[If[rs[n] == False && rd[n] =!= False, Sow[n]], {n, 0, 140}]][[2, 1]] (* Jean-François Alcover, Oct 26 2015 *)
  • Python
    from itertools import count, islice
    from sympy import factorint
    def A263737_gen(): # generator of terms
        return filter(lambda n:n & 3 != 2 and any(p & 3 == 3 and e & 1 for p, e in factorint(n).items()),count(0))
    A263737_list = list(islice(A263737_gen(),30)) # Chai Wah Wu, Jun 28 2022

A096315 Dimensions n such that the integer lattice Z^n contains n+1 equidistant points (i.e., the vertices of a regular n-simplex).

Original entry on oeis.org

1, 3, 7, 8, 9, 11, 15, 17, 19, 23, 24, 25, 27, 31, 33, 35, 39, 43, 47, 48, 49, 51, 55, 57, 59, 63, 67, 71, 73, 75, 79, 80, 81, 83, 87, 89, 91, 95, 97, 99, 103, 105, 107, 111, 115, 119, 120, 121, 123, 127, 129, 131, 135, 139, 143, 145, 147, 151, 155, 159, 161, 163, 167
Offset: 1

Views

Author

David Radcliffe, Aug 01 2004

Keywords

Comments

Schoenberg proved that a regular n-simplex can be inscribed in Z^n in the following cases and no others: (1) n is even and n+1 is a square; (2) n == 3 (mod 4); (3) n == 1 (mod 4) and n+1 is the sum of two squares.

Examples

			There is no equilateral triangle in the plane whose vertices have integer coordinates, so 2 is not on the list. But there is a regular tetrahedron in space whose vertices have integer coordinates, namely (0,0,0), (0,1,1), (1,0,1), (1,1,0), hence 3 is on the list.
		

Crossrefs

Contains A033996 except 0.

Programs

  • Maple
    select(n->(is(n,even) and issqr(n+1)) or (n mod 4 = 3) or ((n mod 4 = 1) and (numtheory[sum2sqr](n+1)<>[])),[ $1..200]);

A287960 Numbers that are the sum of two centered triangular numbers (A005448).

Original entry on oeis.org

2, 5, 8, 11, 14, 20, 23, 29, 32, 35, 38, 41, 47, 50, 56, 62, 65, 68, 74, 77, 83, 86, 89, 92, 95, 104, 110, 113, 116, 119, 128, 131, 137, 140, 146, 149, 155, 167, 170, 173, 176, 182, 185, 194, 197, 200, 203, 209, 212, 218, 221, 230, 236, 239, 245, 251, 254, 263, 266, 272, 275, 278, 281, 284, 293, 299
Offset: 1

Views

Author

Ilya Gutkovskiy, Jun 03 2017

Keywords

Crossrefs

Programs

  • Mathematica
    nmax = 300; f[x_] := Sum[x^(3 k (k - 1)/2 + 1), {k, 1, 20}]^2; Exponent[#, x] & /@ List @@ Normal[Series[f[x], {x, 0, nmax}]]

Formula

8*a(n) = 10+3*A097269(n). - R. J. Mathar, Jul 26 2017

A339952 Numbers that are the sum of an even square > 0 and an odd square.

Original entry on oeis.org

5, 13, 17, 25, 29, 37, 41, 45, 53, 61, 65, 73, 85, 89, 97, 101, 109, 113, 117, 125, 137, 145, 149, 153, 157, 169, 173, 181, 185, 193, 197, 205, 221, 225, 229, 233, 241, 245, 257, 261, 265, 269, 277, 281, 289, 293, 305, 313, 317, 325, 333, 337, 349, 353, 365, 369, 373, 377
Offset: 1

Views

Author

Wesley Ivan Hurt, Dec 24 2020

Keywords

Examples

			13 is in the sequence since it is the sum of an even square > 0 and an odd square, 2^2 + 3^2 = 4 + 9 = 13.
		

Crossrefs

Programs

  • Mathematica
    Table[If[Sum[Sign[(Mod[i, 2] Mod[n - i + 1, 2] + Mod[i + 1, 2] Mod[n - i, 2])] (Floor[Sqrt[i]] - Floor[Sqrt[i - 1]]) (Floor[Sqrt[n - i]] - Floor[Sqrt[n - i - 1]]), {i, Floor[n/2]}] > 0, n, {}], {n, 500}] // Flatten
  • Python
    def aupto(limit):
      m = int(limit**.5) + 2
      es = [i*i for i in range(2, m, 2)]
      os = [i*i for i in range(1, m, 2)]
      return sorted(set(a+b for a in es for b in os if a+b <= limit))
    print(aupto(377)) # Michael S. Branicky, May 13 2021

A290275 Numbers that are the sum of distinct odd positive squares.

Original entry on oeis.org

1, 9, 10, 25, 26, 34, 35, 49, 50, 58, 59, 74, 75, 81, 82, 83, 84, 90, 91, 106, 107, 115, 116, 121, 122, 130, 131, 139, 140, 146, 147, 155, 156, 164, 165, 169, 170, 171, 178, 179, 180, 194, 195, 196, 202, 203, 204, 205, 211, 212, 218, 219, 225, 226, 227, 228, 234, 235, 236, 237, 243, 244, 250, 251, 252, 253
Offset: 1

Views

Author

Ilya Gutkovskiy, Jul 25 2017

Keywords

Comments

Complement of A167703.
1922 is the largest of positive integers not in this sequence.

Examples

			139 is in the sequence because 139 = 9 + 49 + 81 = 3^2 + 7^2 + 9^2.
		

Crossrefs

Programs

  • Mathematica
    max = 253; f[x_] := Product[1 + x^(2 k + 1)^2, {k, 0, 10}]; Exponent[#, x] & /@ List @@ Normal[Series[f[x], {x, 0, max}]] // Rest
Showing 1-10 of 14 results. Next