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.

A059029 a(n) = n if n is even, 2*n + 1 if n is odd.

Original entry on oeis.org

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, 32, 67, 34, 71, 36, 75, 38, 79, 40, 83, 42, 87, 44, 91, 46, 95, 48, 99, 50, 103, 52, 107, 54, 111, 56, 115, 58, 119, 60, 123, 62, 127, 64, 131, 66, 135
Offset: 0

Views

Author

Asher Auel, Dec 15 2000

Keywords

Comments

a(n-1) = n^k - 1 mod 2*n, n >= 1, for any k >= 2, also for k = n. - Wolfdieter Lang, Dec 21 2011

Crossrefs

a(n) = A022998(n+1) - 1 = A043547(n+3) - 3. Partial sums in A032438.

Programs

  • Magma
    [n+((n+1)/2)*(1-(-1)^n): n in [0..70]]; // Vincenzo Librandi, Aug 14 2011
  • Maple
    B := (n,m) -> lcm(n,m)/n + lcm(n,m)/m - 1: seq(B(m+2,m),m=1..90);
  • Mathematica
    Table[n +(n+1)*(1-(-1)^n)/2, {n,0,70}] (* G. C. Greubel, Nov 08 2018 *)
    Table[If[EvenQ[n],n,2n+1],{n,0,70}] (* or *) LinearRecurrence[{0,2,0,-1},{0,3,2,7},70] (* Harvey P. Dale, Jul 23 2025 *)
  • PARI
    a(n)=if(n%2,2*n+1,n)
    

Formula

G.f.: x*(x^2 + 2*x + 3)/(1 - x^2)^2. - Ralf Stephan, Jun 10 2003
Third main diagonal of A059026: a(n) = B(n+2, n) = lcm(n+2, n)/(n+2) + lcm(n+2, n)/n - 1 for all n >= 1.
a(2*n) + a(2*n+1) = A016945(n). - Paul Curtz, Aug 29 2008
E.g.f.: 2*x*cosh(x) + (1 + x)*sinh(x). - Franck Maminirina Ramaharo, Nov 08 2018

Extensions

New description from Ralf Stephan, Jun 10 2003