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.

A124625 Even numbers sandwiched between 1's.

Original entry on oeis.org

1, 0, 1, 2, 1, 4, 1, 6, 1, 8, 1, 10, 1, 12, 1, 14, 1, 16, 1, 18, 1, 20, 1, 22, 1, 24, 1, 26, 1, 28, 1, 30, 1, 32, 1, 34, 1, 36, 1, 38, 1, 40, 1, 42, 1, 44, 1, 46, 1, 48, 1, 50, 1, 52, 1, 54, 1, 56, 1, 58, 1, 60, 1, 62, 1, 64, 1, 66, 1, 68, 1, 70, 1, 72, 1, 74, 1, 76, 1, 78, 1, 80, 1, 82, 1, 84
Offset: 0

Views

Author

N. J. A. Sloane, Jun 13 2007

Keywords

Comments

Interleaving of A000012 and A005843.
Created to simplify the definition of A129952.
a(n) = abs(A009531(n-1)).
Starting (1, 2, 1, 4,...): square (1 + x - x^2 - x^3 + x^4 + x^5 - ...) = (1 + 2x - x^2 - 4x^3 + x^4 + 6x^5 - ...).
With a(3) taken as 0, a(n+2) = n^k+1 mod 2*n, n>=1, for any k>=2, also for k=n. - Wolfdieter Lang, Dec 21 2011
Also !(n+2) mod n for n>0 where !n is a subfactorial number (A000166). - Michel Lagneau, Sep 05 2012
Greatest common divisor of n-1 and (n-1) mod 2. - Bruno Berselli, Mar 07 2017

References

  • Murat Sahin and Elif Tan, Conditional (strong) divisibility sequences, Fib. Q., 56 (No. 1, 2018), 18-31.

Crossrefs

Cf. A000012 (all 1's), A005843 (even numbers), A009531, A093178, A152271.

Programs

  • Magma
    &cat[[1, 2*k]: k in [0..42]];
    
  • Maple
    A124625:=n->(n-(n-2)*(-1)^n)/2; seq(A124625(k), k=0..100); # Wesley Ivan Hurt, Oct 19 2013
  • Mathematica
    Join[{1},Riffle[2Range[0,50],1]] (* Harvey P. Dale, Nov 02 2011 *)
  • PARI
    {for(n=0, 85, print1(if(n%2>0, n-1, 1), ","))}
    
  • Python
    print([(n-1)**(n%2) for n in range(0, 86)]) # Karl V. Keller, Jr., Jul 26 2020

Formula

a(n) = 1 for even n, a(n) = n-1 for odd n.
a(2*k) = 1, a(2*k+1) = 2*k.
G.f.: (1 - x^2 + 2*x^3)/((1 - x)^2*(1 + x)^2).
a(n) = (n - (n - 2)*(-1)^n)/2. - Bruno Berselli, May 06 2011
E.g.f.: 1 + x^2*U(0)/2 where U(k) = 1 + 2*x*(k+1)/(2*k + 3 - x*(2*k+3)/(x + 4*(k+2)*(k+1)/U(k+1))) (continued fraction, 3rd kind, 3-step). - Sergei N. Gladkovskii, Oct 20 2012
a(n) = 2*floor(n/2) - (n-1)*((n-1) mod 2). - Wesley Ivan Hurt, Oct 19 2013
a(n) = (n-1)^((1-(-1)^n)/2). - Wesley Ivan Hurt, Mar 21 2015
a(n) = (n-1) - a(a(n-1))*a(n-1), a(0) = 0. - Eli Jaffe, Jun 07 2016
E.g.f.: (x + 1)*cosh(x) - sinh(x). - Ilya Gutkovskiy, Jun 07 2016
a(n) = (-1)^n mod n for n > 0. - Franz Vrabec, Mar 06 2020
a(n) = (n-1)^(n mod 2). - Karl V. Keller, Jr., Aug 01 2020

Extensions

More terms from Klaus Brockhaus, Jun 16 2007
Edited by N. J. A. Sloane, May 21 2008 at the suggestion of R. J. Mathar