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-4 of 4 results.

A097269 Numbers that are the sum of two nonzero squares but not the difference of two nonzero squares.

Original entry on oeis.org

2, 10, 18, 26, 34, 50, 58, 74, 82, 90, 98, 106, 122, 130, 146, 162, 170, 178, 194, 202, 218, 226, 234, 242, 250, 274, 290, 298, 306, 314, 338, 346, 362, 370, 386, 394, 410, 442, 450, 458, 466, 482, 490, 514, 522, 530, 538, 554, 562, 578, 586, 610, 626, 634
Offset: 1

Views

Author

Ray Chandler, Aug 19 2004

Keywords

Comments

Intersection of A000404 (sum of squares) and complement of A024352 (difference of squares).
Numbers of the form 4k+2 = double of an odd number, with the odd number equal to the sum of 2 squares (sequence A057653). - Jean-Christophe Hervé, Oct 24 2015
Numbers that are the sum of two odd squares. - Jean-Christophe Hervé, Oct 25 2015

Examples

			2 = 1^2 + 1^2, 10 = 1^2 + 3^2, 18 = 3^2 + 3^2.
		

Crossrefs

Programs

  • PARI
    is(n)=if(n%4!=2,return(0)); my(f=factor(n/2)); for(i=1,#f[,1],if(bitand(f[i,2],1)==1&&bitand(f[i,1],3)==3, return(0))); 1 \\ Charles R Greathouse IV, May 31 2013
    
  • Python
    from itertools import count, islice
    from sympy import factorint
    def A097269_gen(): # generator of terms
        return filter(lambda n:all(p & 3 != 3 or e & 1 == 0 for p, e in factorint(n//2).items()),count(2,4))
    A097269_list = list(islice(A097269_gen(),30)) # Chai Wah Wu, Jun 28 2022

A062316 Neither the sum or difference of 2 squares.

Original entry on oeis.org

6, 14, 22, 30, 38, 42, 46, 54, 62, 66, 70, 78, 86, 94, 102, 110, 114, 118, 126, 134, 138, 142, 150, 154, 158, 166, 174, 182, 186, 190, 198, 206, 210, 214, 222, 230, 238, 246, 254, 258, 262, 266, 270, 278, 282, 286, 294, 302, 310, 318, 322, 326, 330, 334, 342, 350, 354, 358
Offset: 1

Views

Author

Michel ten Voorde, Jul 05 2001

Keywords

Comments

Elements of A022544 congruent to 2 (mod 4).
Union of numbers congruent to 6 mod 8 (A017137) with numbers of the form 2 * A084109(n). - Franklin T. Adams-Watters, Jan 21 2007
Explanation: odd numbers are equal to the difference between two successive squares and among even numbers, multiples of 4 are of the form (k+2)^2-k^2, thus odd numbers and multiples of 4 are not in the sequence. Conversely, a difference of 2 squares cannot equal 2 (mod 4), thus this sequence contains the integers of the form 4k+2 that are in A022544 (not the sum of two squares); among integers of form 4k+2, this sequence contains all the integers of the form 8n+6 (A017137) that are not the sum of 2 squares because they have at least one prime factor congruent to 3 (mod 4) to an odd power; it also contains integers of the form 8n+2 = 2(4n+1) with 4n+1 not the sum of two squares, which is sequence A084109. - Jean-Christophe Hervé, Oct 24 2015

Examples

			From _Jean-Christophe Hervé_, Oct 24 2015: (Start)
6, 14, 22, 30, 38, 46, ... are in the sequence because they equal 6 (mod 8).
42 = 2*3*7, 66 = 2*3*11, 114 = 2*7*11 are also in the sequence: of the form 2*(4n+1) with 4n+1 not the sum of 2 squares.
(End)
		

Crossrefs

Cf. A022544, A016825, union of A017137 and 2*A084109, complement of A263715.

Programs

  • Maple
    N:= 1000: # to get all terms <= N
    S:= {seq(4*i+2,i=0..floor((N-2)/4))}
      minus {seq(seq(x^2 + y^2, y = x .. floor(sqrt(N-x^2)),2),x=1..floor(sqrt(N)))}:
    sort(convert(S,list)); # Robert Israel, Oct 25 2015
  • Mathematica
    Select[Range@ 360, SquaresR[2, #] == 0 && Mod[#, 4] == 2 &] (* Michael De Vlieger, Oct 26 2015, after Harvey P. Dale at A022544 *)

Formula

a(n) == 2 (mod 4). Subsequence of A016825 (non-differences of squares). All first differences are either 4 or 8, each of which occurs infinitely often. - David W. Wilson, Mar 09 2005
Lim_{n->inf} a(n)/n = 4.

Extensions

More terms from David W. Wilson, Feb 11 2003

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

A263765 Minimum number of squares necessary to write n as a sum or difference of squares.

Original entry on oeis.org

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

Views

Author

Jean-Christophe Hervé, Oct 25 2015

Keywords

Comments

This sequence is equivalent to A002828 (least number of squares that add up to n) for sums and differences of squares. Here the possible forms include not only sums of squares, but also differences like x^2 - y^2 or x^2 + y^2 - z^2.
a(n) <= A002828(n) which is <= 4 (Lagrange's "Four Squares theorem"). In fact, a(n) <= 3: numbers of the form 4k, 4k+1 or 4k+3 are equal to the difference of two squares, therefore a(n) <= 2 in this case, and a(4k+2) <= 3 because 4k+2 = 4k+1+1^2. More precisely, a(4k) = 1 or 2; a(4k+1) = 1 or 2; a(4k+2) = 2 or 3; a(4k+3) = 2.
If A002828(n) = 4, a(n) = 2 (see A004215); if A002828(n) = 3, a(n) = 2 or 3: this shows that the form x^2 + y^2 - z^2 is never necessary to write an integer with the minimum number of squares; and of course, if A002828 = 1 or 2, a(n) = A002828.

Examples

			a(6) = 3 because 6 = 2^2 + 1^2 + 1^2 and 6 is not the sum or the difference of two squares; a(28) = 2 because 28 = 8^2 - 6^2.
		

Crossrefs

Formula

Using the partition of the natural numbers into A000290 (square numbers), A000415 (sum of 2 nonzero squares), A263737 (difference but not sum of 2 squares) and A062316 (neither the sum or difference of 2 squares), the sequence is completely defined by: a(A000290(n)) = 1, a(A000415(n)) = a(A263737(n)) = 2, a(A062316(n)) = 3.
Showing 1-4 of 4 results.