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.

A024352 Numbers which are the difference of two positive squares, c^2 - b^2 with 1 <= b < c.

Original entry on oeis.org

3, 5, 7, 8, 9, 11, 12, 13, 15, 16, 17, 19, 20, 21, 23, 24, 25, 27, 28, 29, 31, 32, 33, 35, 36, 37, 39, 40, 41, 43, 44, 45, 47, 48, 49, 51, 52, 53, 55, 56, 57, 59, 60, 61, 63, 64, 65, 67, 68, 69, 71, 72, 73, 75, 76, 77, 79, 80, 81, 83, 84, 85, 87, 88, 89, 91, 92, 93, 95, 96
Offset: 1

Views

Author

Keywords

Comments

These are the solutions to the equation x^2 + xy = n where y mod 2 = 0, y is positive and x is any positive integer. - Andrew S. Plewe, Oct 19 2007
Ordered different terms of A120070 = 3, 8, 5, 15, 12, 7, ... (which contains two 15's, two 40's, and two 48's). Complement: A139544. (See A139491.) - Paul Curtz, Sep 01 2009
A024359(a(n)) > 0. - Reinhard Zumkeller, Nov 09 2012
If a(n) mod 6 = 3, n > 1, then a(n) = c^2 - f(a(n))^2 where f(n) = (floor(4*n/3) - 3 - n)/2. For example, 171 = 30^2 - 27^2 and f(171) = 27. - Gary Detlefs, Jul 15 2014

Crossrefs

Same as A042965 except for initial terms. - Michael Somos, Jun 08 2000
Different from A020884.

Programs

  • Haskell
    a024352 n = a024352_list !! (n-1)
    a024352_list = 3 : drop 4 a042965_list
    -- Reinhard Zumkeller, Nov 09 2012
    
  • Magma
    [3] cat [4 +Floor((4*n-3)/3): n in [2..100]]; // G. C. Greubel, Apr 22 2023
    
  • Mathematica
    Union[Flatten[Table[Select[Table[b^2 - c^2, {c, b-1}], # < 100 &], {b, 100}]]] (* Robert G. Wilson v, Jun 05 2004 *)
    LinearRecurrence[{1,0,1,-1},{3,5,7,8,9},70] (* Harvey P. Dale, Dec 20 2021 *)
  • PARI
    is(n)=(n%4!=2 && n>4) || n==3 \\ Charles R Greathouse IV, May 31 2013
    
  • Python
    def A024352(n): return 3 if n==1 else 3+(n<<2)//3 # Chai Wah Wu, Feb 10 2025
  • SageMath
    def A024352(n): return 4 + ((4*n-3)//3) - int(n==1)
    [A024352(n) for n in range(1,101)] # G. C. Greubel, Apr 22 2023
    

Formula

Consists of all positive integers except 1, 4 and numbers == 2 (mod 4).
a(n) = a(n-3) + 4, n > 4.
G.f.: (3 + 2*x + 2*x^2 - 2*x^3 - x^4)/(1 - x - x^3 + x^4). - Ralf Stephan, before May 13 2008
a(n) = a(n-1) + a(n-3) - a(n-4), for n > 5. - Ant King, Oct 03 2011
a(n) = 4 + floor((4*n-3)/3), n > 1. - Gary Detlefs, Jul 15 2014

Extensions

Edited by N. J. A. Sloane, Sep 19 2008

A024359 Number of primitive Pythagorean triangles with short leg n.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Consider primitive Pythagorean triangles (A^2 + B^2 = C^2, (A, B) = 1, A <= B); sequence gives number of times A takes value n.
Number of times n occurs in A020884.
a(A139544(n)) = 0; a(A024352(n)) > 0. - Reinhard Zumkeller, Nov 09 2012

Crossrefs

Cf. A020884, A024352, A024360, A024361, A132404 (where records occur), A139544.

Programs

  • Haskell
    a024359_list = f 0 1 a020884_list where
       f c u vs'@(v:vs) | u == v = f (c + 1) u vs
                        | u /= v = c : f 0 (u + 1) vs'
    -- Reinhard Zumkeller, Nov 09 2012
    
  • Mathematica
    solns[a_] := Module[{b, c, soln}, soln = Reduce[a^2 + b^2 == c^2 && a < b && c > 0 && GCD[a, b, c] == 1, {b, c}, Integers]; If[soln === False, 0, If[soln[[1, 1]] === b, 1, Length[soln]]]]; Table[solns[n], {n, 100}]
    (* Second program: *)
    a[n_] := Module[{s = 0, b, c, d, g}, Do[g = Quotient[n^2, d]; If[d <= g && Mod[d+g, 2] == 0, c = Quotient[d+g, 2]; b = g-c; If[n < b && GCD[b, c] == 1, s++]], {d, Divisors[n^2]}]; s]; Array[a, 100] (* Jean-François Alcover, Apr 27 2019, from PARI *)
  • PARI
    nppt(a) = {
      my(s=0, b, c, d, g);
      fordiv(a^2, d,
        g=a^2\d;
        if(d<=g && (d+g)%2==0,
          c=(d+g)\2; b=g-c;
          if(aColin Barker, Oct 25 2015

Formula

a(n) = A024361(n) - A024360(n). - Ray Chandler, Feb 03 2020

A322489 Numbers k such that k^k ends with 4.

Original entry on oeis.org

2, 18, 22, 38, 42, 58, 62, 78, 82, 98, 102, 118, 122, 138, 142, 158, 162, 178, 182, 198, 202, 218, 222, 238, 242, 258, 262, 278, 282, 298, 302, 318, 322, 338, 342, 358, 362, 378, 382, 398, 402, 418, 422, 438, 442, 458, 462, 478, 482, 498, 502, 518, 522, 538, 542, 558
Offset: 1

Author

Bruno Berselli, Dec 12 2018

Keywords

Comments

Also numbers k == 2 (mod 4) such that 2^k and k^2 end with the same digit.
Numbers congruent to {2, 18} mod 20. - Amiram Eldar, Feb 27 2023

Crossrefs

Subsequence of A139544, A235700.
Numbers k such that k^k ends with d: A008592 (d=0), A017281 (d=1), A067870 (d=3), this sequence (d=4), A017329 (d=5), A271346 (d=6), A322490 (d=7), A017377 (d=9).

Programs

  • GAP
    List([1..70], n -> 10*n+3*(-1)^n-5);
    
  • Julia
    [10*n+3*(-1)^n-5 for n in 1:70] |> println
    
  • Magma
    [10*n+3*(-1)^n-5: n in [1..70]];
    
  • Maple
    select(n->n^n mod 10=4,[$1..558]); # Paolo P. Lava, Dec 18 2018
  • Mathematica
    Table[10 n + 3 (-1)^n - 5, {n, 1, 60}]
  • Maxima
    makelist(10*n+3*(-1)^n-5, n, 1, 70);
    
  • PARI
    apply(A322489(n)=10*n+3*(-1)^n-5, [1..70]) \\ M. F. Hasler, Dec 14 2018
    
  • PARI
    Vec(2*x*(1 + 8*x + x^2) / ((1 - x)^2*(1 + x)) + O(x^70)) \\ Colin Barker, Dec 13 2018
  • Python
    [10*n+3*(-1)**n-5 for n in range(1, 70)]
    
  • Sage
    [10*n+3*(-1)^n-5 for n in (1..70)]
    

Formula

O.g.f.: 2*x*(1 + 8*x + x^2)/((1 + x)*(1 - x)^2).
E.g.f.: 2 + 3*exp(-x) + 5*(2*x - 1)*exp(x).
a(n) = -a(-n+1) = a(n-1) + a(n-2) - a(n-3).
a(n) = 10*n + 3*(-1)^n - 5. Therefore:
a(n) = 10*n - 8 for odd n;
a(n) = 10*n - 2 for even n.
a(n+2*k) = a(n) + 20*k.
Sum_{n>=1} (-1)^(n+1)/a(n) = tan(2*Pi/5)*Pi/20 = sqrt(5+2*sqrt(5))*Pi/20. - Amiram Eldar, Feb 27 2023

A270783 Numbers of the form p^2 + q^2 + r^2 + s^2 = a^2 + b^2 + c^2 for some primes p, q, r, and s and some integers a, b, and c.

Original entry on oeis.org

16, 21, 26, 36, 37, 42, 52, 58, 61, 66, 68, 76, 82, 84, 100, 106, 108, 116, 132, 133, 138, 148, 154, 164, 172, 178, 180, 181, 186, 196, 202, 204, 212, 226, 228, 236, 244, 250, 260, 268, 276, 292, 298, 300, 301, 306, 308, 322, 324, 332, 340
Offset: 1

Author

Griffin N. Macris, Mar 23 2016

Keywords

Comments

This sequence is infinite since 4p^2 = 0^2 + 0^2 + (2p)^2 is in the sequence for all primes p.
A069262 is a subsequence.
It appears at first that the squares of A139544(n) for n >= 3 are a subsequence. n=22 is the first counterexample, where A139544(22)^2 = 6084 is not an element of this sequence.

Examples

			a(1) = 16 = 2^2 + 2^2 + 2^2 + 2^2 = 0^2 + 0^2 + 4^2.
		

Crossrefs

Difference of A214515 and A270781.
Difference of A214515 and A004215.

Programs

  • Sage
    n=340 #change for more terms
    P=prime_range(1,ceil(sqrt(n)))
    S=cartesian_product_iterator([P,P,P,P])
    A=list(Set([sum(i^2 for i in y) for y in S if sum(i^2 for i in y)<=n]))
    A.sort()
    T=[sum(i^2 for i in y) for y in cartesian_product_iterator([[0..ceil(sqrt(n))],[0..ceil(sqrt(n))],[0..ceil(sqrt(n))]])]
    [x for x in A if x in T] # Tom Edgar, Mar 24 2016
Showing 1-4 of 4 results.