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

A034178 Number of solutions to n = a^2 - b^2, a > b >= 0.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Also, number of ways n can be expressed as the sum of one or more consecutive odd numbers. (E.g., 45 = 45 = 13+15+17 = 5+7+9+11+13, so a(45)=3.) - Naohiro Nomoto, Feb 26 2002
a(A042965(n))>0, a(A016825(n))=0; also number of occurrences of n in A094728. - Reinhard Zumkeller, May 24 2004
It appears a(n) can be found by adding together the divisor pairs of n and finding the number of even results. For example: n=9 has the divisor pairs (1,9) and (3,3); adding the pairs: 1+9=10 is even and 3+3=6 is even, so a(9)=2. Another example: n=96 has the divisor pairs (1,96) (2,48) (3,32) (4,24) (6,16) (8,12); when each pair is added there are 4 even results, so a(96)=4. - Gregory Bryant, Dec 06 2016
It appears a(n) is the number of nonnegative integers k for which sqrt(k) + sqrt(k + n) is an integer. For example: a(2015) = 4 since there are only four nonnegative integers k for which sqrt(k) + sqrt(k + 2015) is an integer, namely k = 289, 5041, 39601, 1014049. - Joseph Barrera, Nov 29 2020

Examples

			G.f. = x + x^3 + x^4 + x^5 + x^7 + x^8 + 2*x^9 + x^11 + x^12 + x^13 + 2*x^15 + ...
From _Bernard Schott_, Apr 19 2019: (Start)
a(8) = floor((A000005(2) + 1)/2) = floor(3/2) = 1 and 8 = 3^2 - 1^2.
a(9) = floor((A000005(9) + 1)/2) = floor(4/2) = 2 and 9 = 3^2 - 0^2 = 5^2 - 4^2.
a(10) = 0 and a^2 - b^2 = 10 has no solution.
a(11) = floor(A000005(11) + 1)/2 = floor(3/2) = 1 and 11 = 6^2 - 5^2.  (End)
		

Crossrefs

Programs

  • Mathematica
    nn = 100; t = Table[0, {nn}]; Do[n = a^2 - b^2; If[n <= nn, t[[n]]++], {a, nn}, {b, 0, a - 1}];t (* T. D. Noe, May 04 2011 *)
    Table[Length[FindInstance[a^2-b^2==n&&a>b>=0,{a,b},Integers,10]],{n,100}] (* Harvey P. Dale, Jul 28 2021 *)
  • PARI
    a(n)=sum(k=1, sqrtint(n), (n-k^2)%(2*k)==0) \\ Charles R Greathouse IV, Sep 27 2012
    
  • PARI
    a(n)=sumdiv(n, d, n>=d^2 && (n-d^2)%(2*d)==0) \\ Charles R Greathouse IV, Sep 27 2012
    
  • Python
    from sympy import divisor_count as d
    def a(n): return (d(n)+1)//2 if n%2==1 else ((d(n//4)+1)//2 if n%4==0 else 0)
    # Ely Golden, Jan 26 2025

Formula

From Naohiro Nomoto, Feb 26 2002: (Start)
a(2k) = A038548(2k) - A001227(k).
a(2k+1) = A038548(2k+1). (End)
From Bernard Schott, Apr 11 2019: (Start) (see Crux link)
a(n) = 0 if n == 2 (mod 4)
a(n) = floor((A000005(n) + 1)/2) if n == 1 or n == 3 (mod 4)
a(n) = floor((A000005(n/4) + 1)/2) if n == 0 (mod 4). (End)
G.f.: Sum_{i>=1} Sum_{j>=i} Product_{k=i..j} x^(2*k-1). - Ilya Gutkovskiy, Apr 18 2019
G.f.: Sum_{n>=1} x^(n^2)/(1-x^(2*n)) (conjecture). - Joerg Arndt, Jan 04 2024

A257409 Values of n such that there are exactly 2 solutions to x^2 - y^2 = n, with x > y >= 0.

Original entry on oeis.org

9, 15, 16, 21, 24, 25, 27, 32, 33, 35, 36, 39, 40, 49, 51, 55, 56, 57, 60, 65, 69, 77, 84, 85, 87, 88, 91, 93, 95, 100, 104, 108, 111, 115, 119, 121, 123, 125, 129, 132, 133, 136, 140, 141, 143, 145, 152, 155, 156, 159, 161, 169, 177, 183, 184, 185, 187, 196
Offset: 1

Views

Author

Colin Barker, Apr 22 2015

Keywords

Comments

A subsequence of A058957. Terms in the latter but not here are 45, 48, 63, 64, 72, 75, 80, 81, 96, 99, ... - M. F. Hasler, Apr 22 2015

Examples

			9 is in the sequence because there are 2 solutions to x^2 - y^2 = 9, namely (x,y) = (3,0), (5,4).
		

Crossrefs

Programs

  • Mathematica
    r[n_] := Reduce[x^2 - y^2 == n && x > y >= 0, {x, y}, Integers]; Reap[For[n = 1, n < 200, n++, rn = r[n]; If[rn[[0]] === Or && Length[rn] == 2, Print[n]; Sow[n]]]][[2, 1]] (* Jean-François Alcover, Apr 22 2015 *)
  • PARI
    is_A257409(n)={A034178(n)==2} \\ M. F. Hasler, Apr 22 2015

A306102 Numbers that are the difference of two positive squares in at least two ways.

Original entry on oeis.org

15, 21, 24, 27, 32, 33, 35, 39, 40, 45, 48, 51, 55, 56, 57, 60, 63, 64, 65, 69, 72, 75, 77, 80, 81, 84, 85, 87, 88, 91, 93, 95, 96, 99, 104, 105, 108, 111, 112, 115, 117, 119, 120, 123, 125, 128, 129, 132, 133, 135, 136, 140, 141, 143, 144, 145, 147, 152, 153, 155, 156
Offset: 1

Views

Author

Geoffrey B. Campbell (Geoffrey.Campbell(AT)anu.edu.au), Jul 10 2018

Keywords

Comments

Numbers n such that A100073(n) >= 2; see there for more information and formulas.
In sequence A058957 the smaller square is allowed to be zero, therefore it lists all squares > 4 (m^2 - 0^2 = ((m^2+1)/2)^2 - ((m^2-1)/2)^2 if odd, = (m^2/4+1)^2 - (m^2/4-1)^2 if even) in addition to the terms given here, which already comprise squares (64, 144, ...) having more representations than these "trivial" ones. - M. F. Hasler, Jul 11 2018

Crossrefs

Contains A306103 and A306104 as subsequences.

Programs

  • Mathematica
    Select[Range@156, Length@ FindInstance[x^2 - y^2 == # && x>y>0, {x,y}, Integers, 2] == 2 &] (* Giovanni Resta, Jul 10 2018 *)
  • PARI
    select( is(n)=A100073(n)>1, [1..200]) \\ M. F. Hasler, Jul 10 2018

Formula

A306102 = { n = 2k+1 | A056924(n) > 1 } U { n = 4k | A056924(n/4) > 1 }. - M. F. Hasler, Jul 10 2018

A306103 Numbers that are the difference of two positive squares in at least three ways.

Original entry on oeis.org

45, 48, 63, 72, 75, 80, 96, 99, 105, 112, 117, 120, 128, 135, 144, 147, 153, 160, 165, 168, 171, 175, 176, 180, 189, 192, 195, 200, 207, 208, 216, 224, 225, 231, 240, 243, 245, 252, 255, 256, 261, 264, 272, 273, 275, 279, 280, 285, 288, 297, 300
Offset: 1

Views

Author

Geoffrey B. Campbell and M. F. Hasler, Jul 10 2018

Keywords

Comments

Numbers n such that A100073(n) >= 3; see there for more information & formulas.

Examples

			48 = 7^2 - 1^2 = 8^2 - 4^2 = 13^2 - 11^2.
		

Crossrefs

Subsequence of A306102. Contains A306104 as a subsequence.

Programs

  • Mathematica
    Select[Range[300], Length[FindInstance[x^2 - y^2 == # && x>y>0, {x,y}, Integers, 3 ]] == 3 &] (* Giovanni Resta, Jul 10 2018 *)
  • PARI
    select( is(n)=A100073(n)>2, [1..300])

Formula

A306103 = { n = 2k+1 | A056924(n) > 2 } U { n = 4k | A056924(n/4) > 2 }.

A306104 Numbers that are the difference of two positive squares in at least four ways.

Original entry on oeis.org

96, 105, 120, 135, 144, 160, 165, 168, 189, 192, 195, 216, 224, 225, 231, 240, 255, 264, 273, 280, 285, 288, 297, 312, 315, 320, 336, 345, 351, 352, 357, 360, 375, 384, 385, 399, 400, 405, 408, 416, 420, 429, 432, 435, 440, 441, 448, 455, 456, 459, 465, 480, 483, 495
Offset: 1

Views

Author

Geoffrey B. Campbell and M. F. Hasler, Jul 10 2018

Keywords

Comments

Numbers n such that A100073(n) >= 4; see there for more information & formulas.

Examples

			96 = 10^2 - 2^2 = 11^2 - 5^2 = 14^2 - 10^2 = 25^2 - 23^2.
		

Crossrefs

Subsequence of A306103, A306102 and A058957.

Programs

  • Mathematica
    Select[Range@495, Length@ FindInstance[x^2 - y^2 == # && x>y>0, {x, y}, Integers, 4] == 4 &] (* Giovanni Resta, Jul 10 2018 *)
  • PARI
    select( is(n)=A100073(n)>3, [1..500])

Formula

A306104 = { n = 2k+1 | A056924(n) > 3 } U { n = 4k | A056924(n/4) > 3 }.
Showing 1-5 of 5 results.