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

A048759 Longest perimeter of a Pythagorean triangle with n as length of one of the three sides.

Original entry on oeis.org

12, 12, 30, 24, 56, 40, 90, 60, 132, 84, 182, 112, 240, 144, 306, 180, 380, 220, 462, 264, 552, 312, 650, 364, 756, 420, 870, 480, 992, 544, 1122, 612, 1260, 684, 1406, 760, 1560, 840, 1722, 924, 1892, 1012, 2070, 1104, 2256, 1200, 2450, 1300, 2652
Offset: 3

Views

Author

Henry Bottomley, Jun 15 2000

Keywords

Crossrefs

Programs

  • Magma
    [(3*n^2+4*n-n^2*(-1)^n)/4: n in [3..60]]; // Vincenzo Librandi, Jul 19 2015
  • Mathematica
    A048759[n_] := (3 - (-1)^n)*n^2 / 4 + n; Array[A048759, 100, 3] (* or *)
    LinearRecurrence[{0, 3, 0, -3, 0, 1}, {12, 12, 30, 24, 56, 40}, 100] (* Paolo Xausa, Feb 29 2024 *)
  • PARI
    Vec(-2*x^3*(2*x^5+x^4-6*x^3-3*x^2+6*x+6)/((x-1)^3*(x+1)^3) + O(x^100)) \\ Colin Barker, Sep 13 2014
    

Formula

a(n) = n*A029578(n+2) = n+A055523(n)+A055524(n).
a(2*k) = 2*k*(k+1), a(2*k+1) = 2*(2*k+1)*(k+1).
a(n) = 3*a(n-2)-3*a(n-4)+a(n-6). - Colin Barker, Sep 13 2014
G.f.: -2*x^3*(2*x^5+x^4-6*x^3-3*x^2+6*x+6) / ((x-1)^3*(x+1)^3). - Colin Barker, Sep 13 2014
a(n) = (3*n^2+4*n-n^2*(-1)^n)/4. - Luce ETIENNE, Jul 18 2015
E.g.f.: x*((4 + x)*cosh(x) + (3 + 2*x)*sinh(x) - 4*(1 + x))/2. - Stefano Spezia, May 24 2021

A056136 Largest positive integer whose harmonic mean with another positive integer is n.

Original entry on oeis.org

1, 2, 6, 6, 15, 12, 28, 20, 45, 30, 66, 42, 91, 56, 120, 72, 153, 90, 190, 110, 231, 132, 276, 156, 325, 182, 378, 210, 435, 240, 496, 272, 561, 306, 630, 342, 703, 380, 780, 420, 861, 462, 946, 506, 1035, 552, 1128, 600, 1225, 650, 1326, 702, 1431, 756, 1540
Offset: 1

Views

Author

Henry Bottomley, Jun 13 2000

Keywords

Crossrefs

Cf. A008619 for the smallest integer whose harmonic mean with another integer is n (i.e. harmonic mean of A008619 and a(n) is n).

Formula

a(n) =1/(2/n-1/floor[n/2+1]) =n*A008619(n)/(2*A008619(n)-n) =(n/2)*A029578(n+2)

A082404 Triangle in which n-th row gives trajectory of n under the map x -> x/2 if x is even, x -> x-1 if x is odd, stopping when we reach 1.

Original entry on oeis.org

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

Views

Author

Cino Hilliard, Apr 14 2003

Keywords

Comments

If you write down 0 when dividing by 2, 1 when subtracting 1, the trajectory gives the binary expansion of n.
The length of the n-th row of the triangle is A056792(n). - Nathaniel Johnston, Apr 21 2011

Examples

			Triangle begins:
  1;
  2, 1;
  3, 2, 1;
  4, 2, 1,
  5, 4, 2, 1;
  6, 3, 2, 1;
  7, 6, 3, 2, 1;
  8, 4, 2, 1;
  9, 8, 4, 2, 1;
  ...
		

Crossrefs

Programs

  • Maple
    A082404 := proc(n,k) option remember: if(k = 1)then return n:elif(A082404(n,k-1) mod 2 = 0)then return A082404(n,k-1)/2: else return A082404(n,k-1)-1: fi: end:
    for n from 1 to 20 do k:=1: while A082404(n,k)>=1 do printf("%d, ",A082404(n,k)); k:=k+1: od:printf("\n");od: # Nathaniel Johnston, Apr 21 2011

Formula

T(n, 1) = n, T(n, 2) = A029578(n).

Extensions

More terms and changed offset from Nathaniel Johnston, Apr 21 2011

A124038 Triangle read by rows: T(n, k) = T(n-1, k-1) - T(n-2, k), with T(n, n) = 1, T(n, n-1) = -2.

Original entry on oeis.org

1, -2, 1, -1, -2, 1, 2, -2, -2, 1, 1, 4, -3, -2, 1, -2, 3, 6, -4, -2, 1, -1, -6, 6, 8, -5, -2, 1, 2, -4, -12, 10, 10, -6, -2, 1, 1, 8, -10, -20, 15, 12, -7, -2, 1, -2, 5, 20, -20, -30, 21, 14, -8, -2, 1, -1, -10, 15, 40, -35, -42, 28, 16, -9, -2, 1
Offset: 0

Views

Author

Gary W. Adamson and Roger L. Bagula, Nov 03 2006

Keywords

Examples

			Triangular sequence begins as:
   1;
  -2,   1;
  -1,  -2,   1;
   2,  -2,  -2,   1;
   1,   4,  -3,  -2,   1;
  -2,   3,   6,  -4,  -2,   1;
  -1,  -6,   6,   8,  -5,  -2,  1;
   2,  -4, -12,  10,  10,  -6, -2,  1;
   1,   8, -10, -20,  15,  12, -7, -2,  1;
  -2,   5,  20, -20, -30,  21, 14, -8, -2,  1;
  -1, -10,  15,  40, -35, -42, 28, 16, -9, -2, 1;
		

Crossrefs

Row reversal of: A374439.
Columns are related to: A000034 (k=0), A029578 (k=1), A131259 (k=2).
Diagonals are related to: A113679 (k=n-1), A022958 (k=n-2), A005843 (k=n-3), A000217 (k=n-4), -A002378 (k=n-5).
Sums include: (-1)^floor((n+1)/2)*A016116 (signed diagonal), A057079 (row), A119910 (signed row), (-1)^n*A130706 (diagonal).

Programs

  • Magma
    function T(n,k) // T = A124038
      if k lt 0 or k gt n then return 0;
      elif k ge n-2 then return k-n + (-1)^(n+k);
      else return T(n-1,k-1) - T(n-2,k);
      end if;
    end function;
    [T(n,k): k in [0..n], n in [0..12]]; // G. C. Greubel, Jan 22 2025
  • Mathematica
    (* First program *)
    t[n_, m_, d_]:= If[n==m && n>1 && m>1, x, If[n==m-1 || n==m+1, -1, If[n==m== 1, x-2, 0]]];
    M[d_]:= Table[t[n,m,d], {n,d}, {m,d}];
    Join[{{1}}, Table[CoefficientList[Table[Det[M[d]], {d,10}][[d]], x], {d,10}]]//Flatten
    (* Second program *)
    T[n_, k_]:= T[n, k] = If[k<0 || k>n, 0, If[k>n-2, k-n+(-1)^(n-k), T[n-1, k- 1] -T[n-2,k]]];
    Table[T[n,k], {n,0,12}, {k,0,n}]//Flatten (* G. C. Greubel, Jan 22 2025 *)
  • SageMath
    @CachedFunction
    def A124038(n,k):
        if n< 0: return 0
        if n==0: return 1 if k == 0 else 0
        h = 2*A124038(n-1,k) if n==1 else 0
        return A124038(n-1,k-1) - A124038(n-2,k) - h
    for n in (0..9): [A124038(n,k) for k in (0..n)] # Peter Luschny, Nov 20 2012
    
  • SageMath
    from sage.combinat.q_analogues import q_stirling_number2
    def A124038(n,k): return (1 + ((n-k)%2))*q_stirling_number2(n+1, n-k+1, -1)
    print(flatten([[A124038(n, k) for k in range(n+1)] for n in range(13)])) # G. C. Greubel, Jan 22 2025
    

Formula

From G. C. Greubel, Jan 22 2025: (Start)
T(n, k) = T(n-1, k-1) - T(n-2, k), with T(n, n) = 1, T(n, n-1) = -2.
T(n, k) = (-1)^floor((n-k+1)/2)*(1 + (n-k mod 2))*qStirling2(n+1, n-k+1,-1).
T(2*n, n) = (1/2)*(-1)^floor(n/2)*( (1+(-1)^n)*A005809(n/2) - 2*(1-(-1)^n)* A045721((n-1)/2) ). (End)

Extensions

Edited by G. C. Greubel, Jan 22 2025

A174595 a(n) = 5*n^2/8 - n + 1/2 + (-1)^n*(-3*n^2/8 + n - 1/2).

Original entry on oeis.org

0, 0, 1, 4, 4, 16, 9, 36, 16, 64, 25, 100, 36, 144, 49, 196, 64, 256, 81, 324, 100, 400, 121, 484, 144, 576, 169, 676, 196, 784, 225, 900, 256, 1024, 289, 1156, 324, 1296, 361, 1444, 400, 1600, 441, 1764, 484, 1936, 529, 2116, 576, 2304, 625, 2500, 676, 2704, 729, 2916, 784, 3136, 841, 3364, 900
Offset: 0

Views

Author

Paul Curtz, Nov 29 2010

Keywords

Comments

Based on A174571.

Programs

  • Magma
    [5*n^2/8-n+1/2+(-1)^n*(-3*n^2/8+n-1/2): n in [0..60]]; // Vincenzo Librandi, Aug 04 2011
    
  • Mathematica
    LinearRecurrence[{0,3,0,-3,0,1},{0,0,1,4,4,16},70] (* Harvey P. Dale, Jun 26 2012 *)
    CoefficientList[Series[1/8 E^-x (-4 - 5 x - 3 x^2 + E^(2 x) (4 - 3 x + 5 x^2)), {x, 0, 50}], x]*Table[k!, {k, 0, 50}] (* Stefano Spezia, Nov 02 2018 *)
  • PARI
    vector(50, n, n--; (5*n^2 -8*n + 4 - (-1)^n*(3*n^2 - 8*n +4))/8) \\ G. C. Greubel, Nov 02 2018

Formula

a(n) = A029578(n)^2.
Interleaving of A000290 and 4*A000290.
G.f.: -x^2*(4*x+1)*(x^2+1) / ( (x-1)^3*(1+x)^3 ).
a(n) = 3*a(n-2) - 3*a(n-4) + a(n-6).
E.g.f.: (1/8)*exp(-x)*(- 4 - 5*x - 3*x^2 +exp(2*x)*(4 - 3*x + 5*x^2)). - Stefano Spezia, Nov 02 2018

A260316 n/3 if 3 divides n, else n-1.

Original entry on oeis.org

0, 0, 1, 1, 3, 4, 2, 6, 7, 3, 9, 10, 4, 12, 13, 5, 15, 16, 6, 18, 19, 7, 21, 22, 8, 24, 25, 9, 27, 28, 10, 30, 31, 11, 33, 34, 12, 36, 37, 13, 39, 40, 14, 42, 43, 15, 45, 46, 16, 48, 49, 17, 51, 52, 18, 54, 55, 19, 57, 58, 20, 60, 61, 21, 63, 64, 22, 66, 67, 23
Offset: 0

Views

Author

Peter Kagey, Jul 22 2015

Keywords

Examples

			a(5) = 5 - 1 = 4 because 5 is not divisible by 3.
a(12) = 12/3 = 4 because 12 is divisible by 3.
		

Crossrefs

A029578 is an analogous case where the divisor is 2 instead of 3.

Programs

  • Mathematica
    Table[If[Mod[n, 3] == 0, n/3, n - 1], {n, 0, 69}] (* or *)
    CoefficientList[Series[x^2*(2 x^3 + 3 x^2 + x + 1)/((x - 1)^2*(x^2 + x + 1)^2), {x, 0, 69}], x] (* Michael De Vlieger, Jul 23 2015 *)
    LinearRecurrence[{0,0,2,0,0,-1},{0,0,1,1,3,4},80] (* Harvey P. Dale, May 20 2018 *)
  • PARI
    concat([0,0], Vec(x^2*(2*x^3+3*x^2+x+1) / ((x-1)^2*(x^2+x+1)^2) + O(x^100))) \\ Colin Barker, Jul 23 2015
  • Ruby
    def a(n);(n%3==0)?n/3:n-1 end
    

Formula

a(3k) = k; a(3k + 1) = 3k; a(3k + 2) = 3k + 1.
a(n) = 2*a(n-3) - a(n-6) for n>5. - Colin Barker, Jul 23 2015
G.f.: x^2*(2*x^3+3*x^2+x+1) / ((x-1)^2*(x^2+x+1)^2). - Colin Barker, Jul 23 2015

A300153 Square array T(n, k) read by antidiagonals upwards, n > 0 and k > 0: T(n, k) is the number of parts inscribed in a rose or rhodonea curve with polar coordinates r = cos(t * (k/n)).

Original entry on oeis.org

1, 4, 4, 2, 1, 3, 8, 12, 12, 8, 3, 4, 1, 4, 5, 12, 20, 24, 24, 20, 12, 4, 2, 9, 1, 10, 3, 7, 16, 28, 4, 40, 40, 4, 28, 16, 5, 8, 12, 12, 1, 12, 14, 8, 9, 20, 36, 48, 56, 60, 60, 56, 48, 36, 20, 6, 3, 2, 4, 20, 1, 21, 4, 3, 5, 11, 24, 44, 60, 72, 80, 84, 84, 80
Offset: 1

Views

Author

Rémy Sigrist, Feb 26 2018

Keywords

Comments

For any real p > 0, the rose or rhodonea curve with polar coordinates r = cos(t * p):
- is dense in the unit disk when p is irrational,
- is closed when p is rational, say p = u/v in reduced form; in that case, the number of parts inscribed in the curve is T(v, u),
- see also the illustration in Links section.

Examples

			Array T(n, k) begins:
  n\k|    1    2    3    4    5    6    7    8    9
  ---+---------------------------------------------
    1|    1    4    3    8    5   12    7   16    9
    2|    4    1   12    4   20    3   28    8   36
    3|    2   12    1   24   10    4   14   48    3
    4|    8    4   24    1   40   12   56    4   72
    5|    3   20    9   40    1   60   21   80   27
    6|   12    2    4   12   60    1   84   24   12
    7|    4   28   12   56   20   84    1  112   36
    8|   16    8   48    4   80   24  112    1  144
    9|    5   36    2   72   25   12   35  144    1
   10|   20    3   60   20    4    9  140   40  180
   11|    6   44   18   88   30  132   42  176   54
...
The following diagram shows the curve for T(2, 1) and the corresponding 4 parts:
                         |
               ########     ########
           #####      #######      #####
        ###          ###   ###          ###
      ###           ##   |   ##           ###
     ##            ##         ##            ##
    ##             #  Part #2  #             ##
   ##              ##         ##              ##
   #                ###  |  ###                #
  -#- - - Part #3  - -#######- -  Part #1 - - -#-
   #                ###  |  ###                #
   ##              ##         ##              ##
    ##             #  Part #4  #             ##
     ##            ##         ##            ##
      ###           ##   |   ##           ###
        ###          ###   ###          ###
           #####      #######      #####
               ########     ########
                         |
		

Crossrefs

Formula

T(1, k) = A022998(k).
T(n, k) = T(n/gcd(n, k), k/gcd(n, k)).
Empirically, when gcd(n, k) = 1, we have the following formulas depending on the parity of n and of k:
| k is odd | k is even
----------+--------------------------------+--------------------
n is odd | T(n, k) = k * A029578(n+1) | T(n, k) = 2 * k * n
n is even | T(n, k) = 2 * k * A029578(n+1) | N/A

A071054 a(2n)=3n+1, a(2n+1)=2n+2.

Original entry on oeis.org

1, 3, 4, 5, 7, 7, 10, 9, 13, 11, 16, 13, 19, 15, 22, 17, 25, 19, 28, 21, 31, 23, 34, 25, 37, 27, 40, 29, 43, 31, 46, 33, 49, 35, 52, 37, 55, 39, 58, 41, 61, 43, 64, 45, 67, 47, 70, 49, 73, 51, 76, 53, 79, 55, 82, 57, 85, 59, 88, 61, 91, 63, 94, 65, 97, 67, 100, 69
Offset: 0

Views

Author

Hans Havermann, May 26 2002

Keywords

Comments

Number of ON cells at n-th generation of 1-D CA defined by Rule 158, starting with a single ON cell at generation 0. Equivalently, number of 1's in n-th row of triangle in A071037. - N. J. A. Sloane, Aug 10 2014

References

  • S. Wolfram, A New Kind of Science, Wolfram Media, 2002; Chapter 3.

Crossrefs

Cf. A029578.

Programs

  • Mathematica
    CoefficientList[Series[(-x^3 + 2 x^2 + 3 x + 1)/(1 - x^2)^2, {x, 0, 100}], x] (* Vincenzo Librandi, Aug 11 2014 *)
    ArrayPlot[CellularAutomaton[158, {{1}, 0}, 20]] (* N. J. A. Sloane, Aug 11 2014 *)

Formula

G.f.: (-x^3+2x^2+3x+1)/(1-x^2)^2.
a(n) = (5/4)*n + 3/2 + (n/4 - 1/2)*(-1)^n. - Robert Israel, Aug 11 2014

Extensions

Simpler definition from N. J. A. Sloane, Aug 11 2014

A236203 Interleave A005563(n), A028347(n).

Original entry on oeis.org

0, 0, 3, 5, 8, 12, 15, 21, 24, 32, 35, 45, 48, 60, 63, 77, 80, 96, 99, 117, 120, 140, 143, 165, 168, 192, 195, 221, 224, 252, 255, 285, 288, 320, 323, 357, 360, 396, 399, 437, 440, 480, 483, 525, 528, 572, 575, 621, 624, 672, 675, 725, 728, 780, 783, 837, 840, 896
Offset: 2

Views

Author

Paul Curtz, Jan 20 2014

Keywords

Comments

A175628 gives the numerators of interleaved Lyman and Balmer series, i.e., A005563(n)/A000290(n+1) and A061037(n+2)/A061038(n+2).
Difference table of a(n):
-1, -3, 0, 0, 3, 5, 8, 12, 15, 21, 24, ...
-2, 3, 0, 3, 2, 3, 4, 3, 6, 3, 8, ...
5, -3, 3, -1, 1, 1, -1, 3, -3, 5, -5, ...
-8, 6, -4, 2, 0, -2, 4, -6, 8, -10, 12, ...
14, -10, 6, -2, -2, 6, -10, 14, -18, 22, -26, ...
-24, 16, -8, 0, 8, -16, 24, -32, 40, -48, 56, ... .
a(n+2) gives the numerators of 0/1, 0/16, 3/4, 5/36, 8/9, 12/64, 15/16, 21/100, 24/25, 32/144, ... . The denominators are A097362(n+1)^2. (Compare A097362 to A029578.)
Note the particular distribution of a(-n). Example:
a(n-9) = 12,15, 5,8, 0,3, -3,0, -4,-1, -3,0, 0,3, 5,8, 12,15, ... .
a(2n) + a(2n+1) = a(-2n-1) + a(-2n-2) = -4,0,8,20,36,56,80,... = 4*A000096(n-1).
a(2n) + a(2n-1) = a(-2n) + a(-2n-1) = -5,-3,3,13,... = A001105(n) - A010716(n).

Crossrefs

Programs

  • GAP
    List([2..60], n-> (2*n^2 +2*n -19 -(2*n-11)*(-1)^n)/8 ); # G. C. Greubel, Dec 04 2019
  • Magma
    [(2*n^2 + 2*n - 19 - (2*n - 11)*(-1)^n)/8: n in [2..60]]; // Vincenzo Librandi, Jul 27 2014
    
  • Maple
    seq( (2*n^2 +2*n -19 -(2*n-11)*(-1)^n)/8, n=2..60); # G. C. Greubel, Dec 04 2019
  • Mathematica
    CoefficientList[Series[x^2(3x^2-2x-3)/((x-1)^3(x+1)^2), {x, 0, 60}], x] (* Vincenzo Librandi, Jul 27 2014 *)
    LinearRecurrence[{1,2,-2,-1,1},{0,0,3,5,8},60] (* Harvey P. Dale, Aug 30 2018 *)
  • PARI
    concat([0,0], Vec(x^4*(3*x^2-2*x-3)/((x-1)^3*(x+1)^2) + O(x^60))) \\ Colin Barker, Jan 26 2014
    
  • Sage
    [(2*n^2 +2*n -19 -(2*n-11)*(-1)^n)/8 for n in (2..60)] # G. C. Greubel, Dec 04 2019
    

Formula

a(n+2) = (period 8: repeat 1, 16, 1, 1, 1, 4, 1, 1)*A175628(n+1).
a(n) = 3*a(n-4) - 3*a(n-8) + a(n-12).
a(n+4) - a(n-4) = 0, 8, 8, ... = A168397.
From Colin Barker, Jan 26 2014: (Start)
a(n) = (n^2 -4)/4 for n even, a(n) = (n^2 +2*n -15)/4 for n odd.
G.f.: x^4*(3 + 2*x - 3*x^2)/ ((1-x)^3*(1+x)^2). (End)
a(n) = (2*n^2 + 2*n - 19 - (2*n - 11)*(-1)^n)/8. - Luce ETIENNE, Jul 26 2014
Sum_{n>=4} (-1)^n/a(n) = 11/48. - Amiram Eldar, Aug 21 2022

Extensions

More terms from Colin Barker, Jan 26 2014

A287638 Odd primes with no other odd primes as prefixes in binary.

Original entry on oeis.org

3, 5, 17, 19, 37, 67, 73, 131, 257, 521, 523, 577, 1033, 1039, 1061, 1063, 1069, 1153, 1163, 2053, 2069, 2081, 2083, 2089, 2113, 2129, 2131, 2137, 2141, 2143, 2333, 4099, 4111, 4129, 4153, 4177, 4229, 4231, 4241, 4243, 4261, 4271, 4273, 4637, 4639, 4643, 4649, 4651, 4657, 4663
Offset: 1

Views

Author

Dan Brumleve, May 28 2017

Keywords

Comments

The sum of the reciprocals converges by the Kraft-McMillan inequality.
Odd primes p such that iterating the map A029578 on p reaches 2 without going through a prime. - Ya-Ping Lu, Oct 20 2021

Examples

			4663 is an odd prime with proper binary prefixes 2331, 1165, 582, 291, 145, 72, 36, 18, 9, 4, 2, 1, and none of these are odd primes.
		

Crossrefs

Odd prime elements of A287117.
Cf. A029578.

Programs

  • Mathematica
    Select[Prime@ Range[2, 800], Function[w, NoneTrue[Array[FromDigits[w[[1 ;; #]], 2] &, Length[w] - 1], And[PrimeQ[#], # != 2] &]]@ IntegerDigits[#, 2] &] (* Michael De Vlieger, Oct 20 2021 *)
  • PARI
    is(n)=if(!isprime(n) || n<3, return(0)); while(n>3, if(isprime(n>>=1), return(n==2))); 1 \\ Charles R Greathouse IV, Jun 12 2017
  • Perl
    sub isp {
      my $x = shift;
      return 0 if $x < 2;
      for my $d (2 .. $x - 1) {
        return 0 if $x % $d == 0;
      }
      return 1;
    }
    sub rots {
      my $x = shift;
      my @x;
      while ($x > 5) {
        $x = int($x / 2);
        push @x, $x;
      }
      @x
    }
    for my $i (1 .. $ARGV[0] // 8000) {
      my @np = grep isp($_), rots($i);
      push @z, $i if isp($i) && $i % 2 && @np == 0;
    }
    print join(", ", @z) . "\n";
    
Previous Showing 11-20 of 22 results. Next