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

A022998 If n is odd then n, otherwise 2n.

Original entry on oeis.org

0, 1, 4, 3, 8, 5, 12, 7, 16, 9, 20, 11, 24, 13, 28, 15, 32, 17, 36, 19, 40, 21, 44, 23, 48, 25, 52, 27, 56, 29, 60, 31, 64, 33, 68, 35, 72, 37, 76, 39, 80, 41, 84, 43, 88, 45, 92, 47, 96, 49, 100, 51, 104, 53, 108, 55, 112, 57, 116, 59, 120, 61, 124, 63, 128, 65, 132, 67
Offset: 0

Views

Author

Keywords

Comments

Also for n > 0: numerator of Sum_{i=1..n} 2/(i*(i+1)), denominator=A026741. - Reinhard Zumkeller, Jul 25 2002
For n > 2: a(n) = gcd(A143051((n-1)^2), A143051(1+(n-1)^2)) = A050873(A000290(n-1), A002522(n-1)). - Reinhard Zumkeller, Jul 20 2008
Partial sums give the generalized octagonal numbers A001082. - Omar E. Pol, Sep 10 2011
Multiples of 4 and odd numbers interleaved. - Omar E. Pol, Sep 25 2011
The Pisano period lengths modulo m appear to be A066043(m). - R. J. Mathar, Oct 08 2011
The partial sums a(n)/A026741(n+1) given by R. Zumkeller in a comment above are 2*n/(n+1) (telescopic sum), and thus converge to 2. - Wolfdieter Lang, Apr 09 2013
a(n) = numerator(H(n,1)), where H(n,1) = 2*n/(n+1) is the harmonic mean of 1 and n. a(n) = 2*n/gcd(2n, n+1) = 2*n/gcd(n+1,2). a(n) = A227041(n,1), n>=1. - Wolfdieter Lang, Jul 04 2013
a(n) = numerator of the mean (2n/(n+1), after reduction), of the compositions of n; denominator is given by A001792(n-1). - Clark Kimberling, Mar 11 2014
A strong divisibility sequence, that is, gcd(a(n), a(m)) = a(gcd(n,m)) for all natural numbers n and m. The sequence of convergents of the 2-periodic continued fraction [0; 1, -4, 1, -4, ...] = 1/(1 - 1/(4 - 1/(1 - 1/(4 - ...)))) begins [0/1, 1/1, 4/3, 3/2, 8/5, 5/3, 12/7, ...]. The present sequence is the sequence of numerators. The sequence of denominators of the continued fraction convergents [1, 1, 3, 2, 5, 3, 7, ...] is A026741, also a strong divisibility sequence. Cf. A203976. - Peter Bala, May 19 2014
a(n) is also the length of the n-th line segment of a rectangular spiral on the infinite square grid. The vertices of the spiral are the generalized octagonal numbers. - Omar E. Pol, Jul 27 2018
a(n) is the number of petals of the Rhodonea curve r = a*cos(n*theta) or r = a*sin(n*theta). - Matt Westwood, Nov 19 2019

Crossrefs

Column 4 of A195151. - Omar E. Pol, Sep 25 2011
Cf. A000034, A001082 (partial sums).
Cf. A227041 (first column). - Wolfdieter Lang, Jul 04 2013
Row 2 of A349593. A385555, A385556, A385557, A385558, A385559, and A385560 are respectively rows 3, 4, 5-6, 7, 8, and 9-10.

Programs

  • Haskell
    a022998 n = a000034 (n + 1) * n
    a022998_list = zipWith (*) [0..] $ tail a000034_list
    -- Reinhard Zumkeller, Mar 31 2012
    
  • Magma
    [((-1)^n+3)*n/2: n in [0..70]]; // Vincenzo Librandi, Sep 17 2011
    
  • Maple
    A022998 := proc(n) if type(n,'odd') then n ; else 2*n; end if; end proc: # R. J. Mathar, Mar 10 2011
  • Mathematica
    Table[n (3 + (-1)^n)/2, {n, 0, 100}] (* Wesley Ivan Hurt, Dec 13 2013 *)
    Table[If[OddQ[n],n,2n],{n,0,150}] (* or *) Riffle[ 2*Range[ 0,150,2], Range[ 1,150,2]] (* Harvey P. Dale, Feb 06 2017 *)
  • PARI
    a(n)=if(n%2,n,2*n)
    
  • Python
    def A022998(n): return n if n&1 else n<<1 # Chai Wah Wu, Mar 05 2024
  • SageMath
    [n*(1+((n+1)%2)) for n in (0..80)] # G. C. Greubel, Jul 31 2022
    

Formula

Denominator of (n+1)*(n-1)*(2*n+1)/(2*n) (for n > 0).
a(n+1) = lcm(n, n+2)/n + lcm(n, n+2)/(n+2) for all n >= 1. - Asher Auel, Dec 15 2000
Multiplicative with a(2^e) = 2^(e+1), a(p^e) = p^e, p > 2.
G.f. x*(1 + 4*x + x^2)/(1-x^2)^2. - Ralf Stephan, Jun 10 2003
a(n) = 3*n/2 + n*(-1)^n/2 = n*(3 + (-1)^n)/2. - Paul Barry, Sep 04 2003
a(n) = A059029(n-1) + 1 = A043547(n+2) - 2.
a(n)*a(n+3) = -4 + a(n+1)*a(n+2).
a(n) = n*(((n+1) mod 2) + 1) = n^2 + 2*n - 2*n*floor((n+1)/2). - William A. Tedeschi, Feb 29 2008
a(n) = denominator((n+1)/(2*n)) for n >= 1; A026741(n+1) = numerator((n+1)/(2*n)) for n >= 1. - Johannes W. Meijer, Jun 18 2009
a(n) = 2*a(n-2) - a(n-4).
Dirichlet g.f. zeta(s-1)*(1+2^(1-s)). - R. J. Mathar, Mar 10 2011
a(n) = n * (2 - n mod 2) = n * A000034(n+1). - Reinhard Zumkeller, Mar 31 2012
a(n) = floor(2*n/(1 + (n mod 2))). - Wesley Ivan Hurt, Dec 13 2013
From Ilya Gutkovskiy, Mar 16 2017: (Start)
E.g.f.: x*(2*sinh(x) + cosh(x)).
It appears that a(n) is the period of the sequence k*(k + 1)/2 mod n. (End) [This is correct; see A349593. - Jianing Song, Jul 03 2025]
a(n) = Sum_{d | n} A345082(d). - Peter Bala, Jan 13 2024

Extensions

More terms from Michael Somos, Aug 07 2000

A043547 Odd numbers interspersed with double the previous odd number.

Original entry on oeis.org

1, 2, 3, 6, 5, 10, 7, 14, 9, 18, 11, 22, 13, 26, 15, 30, 17, 34, 19, 38, 21, 42, 23, 46, 25, 50, 27, 54, 29, 58, 31, 62, 33, 66, 35, 70, 37, 74, 39, 78, 41, 82, 43, 86, 45, 90, 47, 94, 49, 98, 51, 102, 53, 106, 55, 110, 57, 114, 59, 118, 61, 122, 63, 126, 65, 130, 67, 134
Offset: 1

Views

Author

Jim Cook (jcook(AT)halcyon.com), Mar 01 2000

Keywords

Comments

As pointed out by E. Angelini on the SeqFan list (cf. link), this is the lexicographically earliest sequence of positive integers without repetitions such that the sum of four consecutive terms is always a multiple of 4. - M. F. Hasler, Mar 22 2013

Examples

			a(1)=1 because n is odd. a(2)=2 because a(1)*2=2.
		

Crossrefs

For n>3, a(n) = A059029(n-3)+3. For n>1, a(n) = A022998(n-2)+2.

Programs

Formula

a(n) = (2 - n) * (n - floor(n/2) * 2) + 2 * (n - 1).
G.f.: x*(1+2*x)*(1+x^2)/(1-x^2)^2. - Ralf Stephan, Jun 10 2003
a(2n-1) = 2n-1, a(2n) = 4n-2. - M. F. Hasler, Mar 22 2013
From Wesley Ivan Hurt, Nov 22 2015: (Start)
a(n) = 2*a(n-2) - a(n-4) for n>4.
a(n) = n*(-1)^n/2 - (-1)^n + 3*n/2 - 1. (End)

Extensions

More terms from James Sellers, Mar 01 2000

A059026 Table B(n,m) read by rows: B(n,m) = LCM(n,m)/n + LCM(n,m)/m - 1 for all 1<=m<=n.

Original entry on oeis.org

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

Views

Author

Asher Auel, Dec 15 2000

Keywords

Comments

In an n X m box, a ball makes B(n,m) "bounces" starting at one corner until it reaches another corner, only allowed to travel on diagonal grid lines. B(n+2,n) = A022998(n+1) for all n >= 1. B(2n-1,n) = A016777(n) = 3n + 1 for all n >= 1 (central vertical).

Crossrefs

Programs

  • Maple
    B := (n,m) -> lcm(n,m)/n + lcm(n,m)/m - 1: seq(seq(B(n,m), n=1..m),m=1..15);

A032438 a(n) = n^2 - floor((n+1)/2)^2.

Original entry on oeis.org

0, 0, 3, 5, 12, 16, 27, 33, 48, 56, 75, 85, 108, 120, 147, 161, 192, 208, 243, 261, 300, 320, 363, 385, 432, 456, 507, 533, 588, 616, 675, 705, 768, 800, 867, 901, 972, 1008, 1083, 1121, 1200, 1240, 1323, 1365, 1452, 1496, 1587, 1633, 1728, 1776, 1875, 1925
Offset: 0

Views

Author

Keywords

Comments

The answer to a question from Mike and Laurie Crain (2crains(AT)concentric.net): how many even numbers are there in an n X n multiplication table starting at 1 X 1?
a(n+1) is the number of pairs (x,y) with x and y in {0,...,n}, x and y of the same parity, and x+y >= n. - Clark Kimberling, Jul 02 2012
From J. M. Bergot, Aug 08 2013: (Start)
Define a triangle to have T(1,1)=0 and T(n,c) = n^2 - c^2. The difference of the sum of the terms in antidiagonal(n+1) and those in antidiagonal(n)=a(n).
Column 0 is vertical and T(n,n)=0. The first few rows are 0; 3,0; 8,5,0; 15,12,7,0; 24,21,16,9,0; 35,32,27,20,11,0; the first few antidiagonals are 0; 3; 8,0; 15,5; 24,12,0; 35,21,7; 48,32,16,0; the first few sum of terms in the antidiagonals are 0, 3, 8, 20, 36, 63, 96, 144, 200, 275, 360, 468, 588, 735, 896, 1088, 1296, 1539. (End)
Sum of the largest parts in the partitions of 2n into two distinct odd parts. For example, a(5) = 16; the partitions of 2(5) = 10 into two distinct odd parts are (9,1) and (7,3). The sum of the largest parts is then 9+7 = 16. - Wesley Ivan Hurt, Nov 27 2017

Crossrefs

First differences are in A059029, partial sums in A143785.

Programs

  • Magma
    [n^2-Floor( (n+1)/2 )^2 : n in [0..60]]; // Vincenzo Librandi, Sep 27 2011
    
  • Maple
    A032438:=n->n^2-floor((n+1)/2)^2; seq(A032438(n), n=0..100) # Wesley Ivan Hurt, Nov 25 2013
  • Mathematica
    Table[n^2-Floor[((n+1)/2)]^2,{n,0,50}] (* or *) LinearRecurrence[ {1,2,-2,-1,1},{0,0,3,5,12},51]
  • PARI
    a(n)=n^2 - ((n+1)\2)^2 \\ Charles R Greathouse IV, Feb 19 2017

Formula

a(n) = n^2 - A008794(n+1).
G.f.: x^2*(x^2 + 2*x + 3)/(1-x^2)^2/(1-x). - Ralf Stephan, Jun 10 2003
a(n) = (1/8)*(2*n*(3*n-1)+(2*n+1)*(-1)^n-1). a(-n-1) = A014255(n). - Bruno Berselli, Sep 27 2011
a(n) = a(n-1) + 2*a(n-2) - 2*a(n-3) - a(n-4) + a(n-5), n > 4. - Harvey P. Dale, Nov 24 2011
E.g.f.: (x*(1 + 3*x)*cosh(x) + (3*x^2 + 3*x - 1)*sinh(x))/4. - Stefano Spezia, Aug 01 2022

A059030 Fourth main diagonal of A059026: a(n) = B(n+3,n) = lcm(n+3,n)/(n+3) + lcm(n+3,n)/n - 1 for all n >= 1.

Original entry on oeis.org

4, 6, 2, 10, 12, 4, 16, 18, 6, 22, 24, 8, 28, 30, 10, 34, 36, 12, 40, 42, 14, 46, 48, 16, 52, 54, 18, 58, 60, 20, 64, 66, 22, 70, 72, 24, 76, 78, 26, 82, 84, 28, 88, 90, 30, 94, 96, 32, 100, 102, 34, 106, 108, 36, 112, 114, 38, 118, 120, 40, 124, 126, 42, 130
Offset: 1

Views

Author

Asher Auel, Dec 15 2000

Keywords

Crossrefs

Programs

  • Maple
    B := (n,m) -> lcm(n,m)/n + lcm(n,m)/m - 1: seq(B(m+3,m),m=1..90);

Formula

G.f.: x(2x^3+2x^2+6x+4)/(1-x^3)^2.

A059031 Fifth main diagonal of A059026: a(n) = B(n+4,n) = lcm(n+4,n)/(n+4) + lcm(n+4,n)/n - 1 for all n >= 1.

Original entry on oeis.org

5, 3, 9, 2, 13, 7, 17, 4, 21, 11, 25, 6, 29, 15, 33, 8, 37, 19, 41, 10, 45, 23, 49, 12, 53, 27, 57, 14, 61, 31, 65, 16, 69, 35, 73, 18, 77, 39, 81, 20, 85, 43, 89, 22, 93, 47, 97, 24, 101, 51, 105, 26, 109, 55, 113, 28, 117, 59, 121, 30, 125, 63, 129, 32, 133, 67
Offset: 1

Views

Author

Asher Auel, Dec 15 2000

Keywords

Crossrefs

Programs

  • Maple
    B := (n,m) -> lcm(n,m)/n + lcm(n,m)/m - 1: seq(B(m+4,m),m=1..90);
  • Mathematica
    LinearRecurrence[{0,0,0,2,0,0,0,-1},{5,3,9,2,13,7,17,4},70] (* Harvey P. Dale, Aug 19 2019 *)

Formula

a(2n+1) = 4n+5, a(4n+2) = 4n+3, a(4n+4) = 4n+2. - Ralf Stephan, Jun 10 2005
G.f.: -x*(-5-3*x-9*x^2-2*x^3-3*x^4-x^5+x^6) / ( (x-1)^2*(1+x)^2*(x^2+1)^2 ). - R. J. Mathar, Sep 20 2011

A133146 Antidiagonal sums of the triangle A133128.

Original entry on oeis.org

2, 5, 7, 14, 18, 29, 35, 50, 58, 77, 87, 110, 122, 149, 163, 194, 210, 245, 263, 302, 322, 365, 387, 434, 458, 509, 535, 590, 618, 677, 707, 770, 802, 869, 903, 974, 1010, 1085, 1123, 1202, 1242, 1325, 1367, 1454, 1498, 1589, 1635, 1730, 1778, 1877, 1927, 2030
Offset: 0

Views

Author

Paul Curtz, Aug 27 2008

Keywords

Examples

			a(2) = A133128(2,0) + A133128(1,1) = 10 - 3 = 7.
a(3) = A133128(3,0) + A133128(2,1) = 17 - 3 = 14.
		

Programs

  • Magma
    [19/8 +5*n/4 +3*n^2/4 -(-1)^n*(n/4+3/8): n in [0..60]]; // Vincenzo Librandi, Aug 10 2011
  • Mathematica
    CoefficientList[Series[(1+2x)(2-x+x^3)/((1-x)^3(1+x)^2),{x,0,60}],x] (* or *) LinearRecurrence[{1,2,-2,-1,1},{2,5,7,14,18},60] (* Harvey P. Dale, Aug 26 2013 *)

Formula

First differences: a(n+1) - a(n) = A059029(n+1).
Bisections: a(2n+1) = A005918(n+1). a(2n) = A141631(n+1).
G.f.: (1+2*x)(2 - x + x^3)/((1-x)^3*(1+x)^2). - R. J. Mathar, Oct 15 2008
a(n) = 19/8 + 5*n/4 + 3*n^2/4 - (-1)^n*(n/4 + 3/8). - R. J. Mathar, Oct 15 2008
From Harvey P. Dale, Aug 26 2013: (Start)
a(n) = a(n-1) + 2*a(n-2) - 2*a(n-3) - a(n-4) + a(n-5); a(0)=2, a(1)=5, a(2)=7, a(3)=14, a(4)=18. (End)

Extensions

Edited and extended by R. J. Mathar, Oct 15 2008

A115379 Number of positive integers k < n such that n XOR k < n and gcd(n,k) is odd.

Original entry on oeis.org

0, 1, 0, 3, 0, 3, 2, 7, 0, 3, 2, 7, 4, 11, 6, 15, 0, 3, 2, 7, 4, 11, 6, 15, 8, 19, 10, 23, 12, 27, 14, 31, 0, 3, 2, 7, 4, 11, 6, 15, 8, 19, 10, 23, 12, 27, 14, 31, 16, 35, 18, 39, 20, 43, 22, 47, 24, 51, 26, 55, 28, 59, 30, 63, 0, 3, 2, 7, 4, 11, 6, 15, 8, 19, 10, 23, 12, 27, 14, 31, 16, 35
Offset: 0

Views

Author

Paul D. Hanna, Jan 21 2006

Keywords

Comments

A059029 equals the limiting sequence of 2^k consecutive terms of this sequence starting at position 2^k as k increases, where A059029(n) = n if n is even, 2n+1 if n is odd.

Crossrefs

Cf. A059029, A006257 (Josephus problem).

Programs

  • Mathematica
    Table[Sum[If[BitXor[n, k]< n && OddQ[GCD[n, k]], 1, 0], {k, 0, n}], {n, 0, 81}] (* Indranil Ghosh, Mar 16 2017 *)
  • PARI
    a(n)=sum(k=0,n,if(bitxor(n,k)
    				

Formula

a(2^n) = 0, a(2^n-1) = 2^n-1, for n >= 0. a(2^n+1)=3 (n>0), a(2^n+2)=2 (n>1), a(2^n+3)=7 (n>1), a(2^n+4)=4 (n>2), a(2^n+5)=11 (n>2), etc.
Showing 1-8 of 8 results.