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-10 of 54 results. Next

A001787 a(n) = n*2^(n-1).

Original entry on oeis.org

0, 1, 4, 12, 32, 80, 192, 448, 1024, 2304, 5120, 11264, 24576, 53248, 114688, 245760, 524288, 1114112, 2359296, 4980736, 10485760, 22020096, 46137344, 96468992, 201326592, 419430400, 872415232, 1811939328, 3758096384, 7784628224, 16106127360, 33285996544
Offset: 0

Views

Author

Keywords

Comments

Number of edges in an n-dimensional hypercube.
Number of 132-avoiding permutations of [n+2] containing exactly one 123 pattern. - Emeric Deutsch, Jul 13 2001
Number of ways to place n-1 nonattacking kings on a 2 X 2(n-1) chessboard for n >= 2. - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), May 22 2001
Arithmetic derivative of 2^n: a(n) = A003415(A000079(n)). - Reinhard Zumkeller, Feb 26 2002
(-1) times the determinant of matrix A_{i,j} = -|i-j|, 0 <= i,j <= n.
a(n) is the number of ones in binary numbers 1 to 111...1 (n bits). a(n) = A000337(n) - A000337(n-1) for n = 2,3,... . - Emeric Deutsch, May 24 2003
The number of 2 X n 0-1 matrices containing n+1 1's and having no zero row or column. The number of spanning trees of the complete bipartite graph K(2,n). This is the case m = 2 of K(m,n). See A072590. - W. Edwin Clark, May 27 2003
Binomial transform of 0,1,2,3,4,5,... (A001477). Without the initial 0, binomial transform of odd numbers.
With an additional leading zero, [0,0,1,4,...] this is the binomial transform of the integers repeated A004526. Its formula is then (2^n*(n-1) + 0^n)/4. - Paul Barry, May 20 2003
Number of zeros in all different (n+1)-bit integers. - Ralf Stephan, Aug 02 2003
From Lekraj Beedassy, Jun 03 2004: (Start)
Final element of a summation table (as opposed to a difference table) whose first row consists of integers 0 through n (or first n+1 nonnegative integers A001477); illustrating the case n=5:
0 1 2 3 4 5
1 3 5 7 9
4 8 12 16
12 20 28
32 48
80
and the final element is a(5)=80. (End)
This sequence and A001871 arise in counting ordered trees of height at most k where only the rightmost branch at the root actually achieves this height and the count is by the number of edges, with k = 3 for this sequence and k = 4 for A001871.
Let R be a binary relation on the power set P(A) of a set A having n = |A| elements such that for all elements x,y of P(A), xRy if x is a proper subset of y and there are no z in P(A) such that x is a proper subset of z and z is a proper subset of y. Then a(n) = |R|. - Ross La Haye, Sep 21 2004
Number of 2 X n binary matrices avoiding simultaneously the right-angled numbered polyomino patterns (ranpp) (00;1) and (10;1). An occurrence of a ranpp (xy;z) in a matrix A=(a(i,j)) is a triple (a(i1,j1), a(i1,j2), a(i2,j1)) where i1 < i2, j1 < j2 and these elements are in same relative order as those in the triple (x,y,z). - Sergey Kitaev, Nov 11 2004
Number of subsequences 00 in all binary words of length n+1. Example: a(2)=4 because in 000,001,010,011,100,101,110,111 the sequence 00 occurs 4 times. - Emeric Deutsch, Apr 04 2005
If you expand the n-factor expression (a+1)*(b+1)*(c+1)*...*(z+1), there are a(n) variables in the result. For example, the 3-factor expression (a+1)*(b+1)*(c+1) expands to abc+ab+ac+bc+a+b+c+1 with a(3) = 12 variables. - David W. Wilson, May 08 2005
An inverse Chebyshev transform of n^2, where g(x)->(1/sqrt(1-4*x^2))*g(x*c(x^2)), c(x) the g.f. of A000108. - Paul Barry, May 13 2005
Sequences A018215 and A058962 interleaved. - Graeme McRae, Jul 12 2006
The number of never-decreasing positive integer sequences of length n with a maximum value of 2*n. - Ben Paul Thurston, Nov 13 2006
Total size of all the subsets of an n-element set. For example, a 2-element set has 1 subset of size 0, 2 subsets of size 1 and 1 of size 2. - Ross La Haye, Dec 30 2006
Convolution of the natural numbers [A000027] and A045623 beginning [0,1,2,5,...]. - Ross La Haye, Feb 03 2007
If M is the matrix (given by rows) [2,1;0,2] then the sequence gives the (1,2) entry in M^n. - Antonio M. Oller-Marcén, May 21 2007
If X_1,X_2,...,X_n is a partition of a 2n-set X into 2-blocks then, for n > 0, a(n) is equal to the number of (n+1)-subsets of X intersecting each X_i (i=1,2,...,n). - Milan Janjic, Jul 21 2007
Number of n-permutations of 3 objects u,v,w, with repetition allowed, containing exactly one u. Example: a(2)=4 because we have uv, vu, uw and wu. - Zerinvary Lajos, Dec 27 2007
A member of the family of sequences defined by a(n) = n*[c(1)*...*c(r)]^(n-1); c(i) integer. This sequence has c(1)=2, A027471 has c(1)=3. - Ctibor O. Zizka, Feb 23 2008
a(n) is the number of ways to split {1,2,...,n-1} into two (possibly empty) complementary intervals {1,2,...,i} and {i+1,i+2,...,n-1} and then select a subset from each interval. - Geoffrey Critzer, Jan 31 2009
Equals the Jacobsthal sequence A001045 convolved with A003945: (1, 3, 6, 12, ...). - Gary W. Adamson, May 23 2009
Starting with offset 1 = A059570: (1, 2, 6, 14, 34, ...) convolved with (1, 2, 2, 2, ...). - Gary W. Adamson, May 23 2009
Equals the first left hand column of A167591. - Johannes W. Meijer, Nov 12 2009
The number of tatami tilings of an n X n square with n monomers is n*2^(n-1). - Frank Ruskey, Sep 25 2010
Under T. D. Noe's variant of the hypersigma function, this sequence gives hypersigma(2^n): a(n) = A191161(A000079(n)). - Alonso del Arte, Nov 04 2011
Number of Dyck (n+2)-paths with exactly one valley at height 1 and no higher valley. - David Scambler, Nov 07 2011
Equals triangle A059260 * A016777 as a vector, where A016777 = (3n + 1): [1, 4, 7, 10, 13, ...]. - Gary W. Adamson, Mar 06 2012
Main transitions in systems of n particles with spin 1/2 (see A212697 with b=2). - Stanislav Sykora, May 25 2012
Let T(n,k) be the triangle with (first column) T(n,1) = 2*n-1 for n >= 1, otherwise T(n,k) = T(n,k-1) + T(n-1,k-1), then a(n) = T(n,n). - J. M. Bergot, Jan 17 2013
Sum of all parts of all compositions (ordered partitions) of n. The equivalent sequence for partitions is A066186. - Omar E. Pol, Aug 28 2013
Starting with a(1)=1: powers of 2 (A000079) self-convolved. - Bob Selcoe, Aug 05 2015
Coefficients of the series expansion of the normalized Schwarzian derivative -S{p(x)}/6 of the polynomial p(x) = -(x-x1)*(x-x2) with x1 + x2 = 1 (cf. A263646). - Tom Copeland, Nov 02 2015
a(n) is the number of North-East lattice paths from (0,0) to (n+1,n+1) that have exactly one east step below y = x-1 and no east steps above y = x+1. Details can be found in Pan and Remmel's link. - Ran Pan, Feb 03 2016
Also the number of maximal and maximum cliques in the n-hypercube graph for n > 0. - Eric W. Weisstein, Dec 01 2017
Let [n]={1,2,...,n}; then a(n-1) is the total number of elements missing in proper subsets of [n] that contain n to form [n]. For example, for n = 3, a(2) = 4 since the proper subsets of [3] that contain 3 are {3}, {1,3}, {2,3} and the total number of elements missing in these subsets to form [3] is 4: 2 in the first subset, 1 in the second, and 1 in the third. - Enrique Navarrete, Aug 08 2020
Number of 3-permutations of n elements avoiding the patterns 132, 231. See Bonichon and Sun. - Michel Marcus, Aug 19 2022

Examples

			a(2)=4 since 2314, 2341,3124 and 4123 are the only 132-avoiding permutations of 1234 containing exactly one increasing subsequence of length 3.
x + 4*x^2 + 12*x^3 + 32*x^4 + 80*x^5 + 192*x^6 + 448*x^7 + ...
a(5) = 1*0 + 5*1 + 10*2 + 10*3 + 5*4 + 1*5 = 80, with 1,5,10,10,5,1 the 5th row of Pascal's triangle. - _J. M. Bergot_, Apr 29 2014
		

References

  • M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 796.
  • A. T. Benjamin and J. J. Quinn, Proofs that really count: the art of combinatorial proof, M.A.A. 2003, id. 131.
  • Clifford A. Pickover, The Math Book, From Pythagoras to the 57th Dimension, 250 Milestones in the History of Mathematics, Sterling Publ., NY, 2009, page 282.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Three other versions, essentially identical, are A085750, A097067, A118442.
Partial sums of A001792.
A058922(n+1) = 4*A001787(n).
Equals A090802(n, 1).
Column k=1 of A038207.
Row sums of A003506, A322427, A322428.

Programs

  • Haskell
    a001787 n = n * 2 ^ (n - 1)
    a001787_list = zipWith (*) [0..] $ 0 : a000079_list
    -- Reinhard Zumkeller, Jul 11 2014
    
  • Magma
    [n*2^(n-1): n in [0..40]]; // Vincenzo Librandi, Feb 04 2016
    
  • Maple
    spec := [S, {B=Set(Z, 0 <= card), S=Prod(Z, B, B)}, labeled]: seq(combstruct[count](spec, size=n), n=0..29); # Zerinvary Lajos, Oct 09 2006
    A001787:=1/(2*z-1)^2; # Simon Plouffe in his 1992 dissertation, dropping the initial zero
  • Mathematica
    Table[Sum[Binomial[n, i] i, {i, 0, n}], {n, 0, 30}] (* Geoffrey Critzer, Mar 18 2009 *)
    f[n_] := n 2^(n - 1); f[Range[0, 40]] (* Vladimir Joseph Stephan Orlovsky, Feb 09 2011 *)
    Array[# 2^(# - 1) &, 40, 0] (* Harvey P. Dale, Jul 26 2011 *)
    Join[{0}, Table[n 2^(n - 1), {n, 20}]] (* Eric W. Weisstein, Dec 01 2017 *)
    Join[{0}, LinearRecurrence[{4, -4}, {1, 4}, 20]] (* Eric W. Weisstein, Dec 01 2017 *)
    CoefficientList[Series[x/(-1 + 2 x)^2, {x, 0, 20}], x] (* Eric W. Weisstein, Dec 01 2017 *)
  • PARI
    {a(n) = if( n<0, 0, n * 2^(n-1))}
    
  • PARI
    concat(0, Vec(x/(1-2*x)^2 + O(x^50))) \\ Altug Alkan, Nov 03 2015
    
  • Python
    def A001787(n): return n*(1<Chai Wah Wu, Nov 14 2022

Formula

a(n) = Sum_{k=1..n} k*binomial(n, k). - Benoit Cloitre, Dec 06 2002
E.g.f.: x*exp(2x). - Paul Barry, Apr 10 2003
G.f.: x/(1-2*x)^2.
G.f.: x / (1 - 4*x / (1 + x / (1 - x))). - Michael Somos, Apr 07 2012
A108666(n) = Sum_{k=0..n} binomial(n, k)^2 * a(n). - Michael Somos, Apr 07 2012
PSumSIGN transform of A053220. PSumSIGN transform is A045883. Binomial transform is A027471(n+1). - Michael Somos, Jul 10 2003
Starting at a(1)=1, INVERT transform is A002450, INVERT transform of A049072, MOBIUS transform of A083413, PSUM transform is A000337, BINOMIAL transform is A081038, BINOMIAL transform of A005408. - Michael Somos, Apr 07 2012
a(n) = 2*a(n-1)+2^(n-1).
a(2*n) = n*4^n, a(2*n+1) = (2*n+1)4^n.
G.f.: x/det(I-x*M) where M=[1,i;i,1], i=sqrt(-1). - Paul Barry, Apr 27 2005
Starting 1, 1, 4, 12, ... this is 0^n + n2^(n-1), the binomial transform of the 'pair-reversed' natural numbers A004442. - Paul Barry, Jul 24 2003
Convolution of [1, 2, 4, 8, ...] with itself. - Jon Perry, Aug 07 2003
The signed version of this sequence, n(-2)^(n-1), is the inverse binomial transform of n(-1)^(n-1) (alternating sign natural numbers). - Paul Barry, Aug 20 2003
a(n-1) = (Sum_{k=0..n} 2^(n-k-1)*C(n-k, k)*C(1,(k+1)/2)*(1-(-1)^k)/2) - 0^n/4. - Paul Barry, Oct 15 2004
a(n) = Sum_{k=0..floor(n/2)} binomial(n, k)(n-2k)^2. - Paul Barry, May 13 2005
a(n+2) = A049611(n+2) - A001788(n).
a(n) = n! * Sum_{k=0..n} 1/((k - 1)!(n - k)!). - Paul Barry, Mar 26 2003
a(n+1) = Sum_{k=0..n} 4^k * A109466(n,k). - Philippe Deléham, Nov 13 2006
Row sums of A130300 starting (1, 4, 12, 32, ...). - Gary W. Adamson, May 20 2007
Equals row sums of triangle A134083. Equals A002064(n) + (2^n - 1). - Gary W. Adamson, Oct 07 2007
a(n) = 4*a(n-1) - 4*a(n-2), a(0)=0, a(1)=1. - Philippe Deléham, Nov 16 2008
Sum_{n>0} 1/a(n) = 2*log(2). - Jaume Oliver Lafont, Feb 10 2009
a(n) = A000788(A000225(n)) = A173921(A000225(n)). - Reinhard Zumkeller, Mar 04 2010
a(n) = n * A011782(n). - Omar E. Pol, Aug 28 2013
a(n-1) = Sum_{t_1+2*t_2+...+n*t_n=n} (t_1+t_2+...+t_n-1)*multinomial(t_1+t_2 +...+t_n,t_1,t_2,...,t_n). - Mircea Merca, Dec 06 2013
a(n+1) = Sum_{r=0..n} (2*r+1)*C(n,r). - J. M. Bergot, Apr 07 2014
a(n) = A007283(n)*n/6. - Enxhell Luzhnica, Apr 16 2016
a(n) = (A000225(n) + A000337(n))/2. - Anton Zakharov, Sep 17 2016
Sum_{n>0} (-1)^(n+1)/a(n) = 2*log(3/2) = 2*A016578. - Ilya Gutkovskiy, Sep 17 2016
a(n) = Sum_{k=0..n-1} Sum_{i=0..n-1} (i+1) * C(k,i). - Wesley Ivan Hurt, Sep 21 2017
a(n) = Sum_{i=1..n} Sum_{j=1..n} phi(i)*binomial(n, i*j). - Ridouane Oudra, Feb 17 2024

A003987 Table of n XOR m (or Nim-sum of n and m) read by antidiagonals with m>=0, n>=0.

Original entry on oeis.org

0, 1, 1, 2, 0, 2, 3, 3, 3, 3, 4, 2, 0, 2, 4, 5, 5, 1, 1, 5, 5, 6, 4, 6, 0, 6, 4, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 6, 4, 6, 0, 6, 4, 6, 8, 9, 9, 5, 5, 1, 1, 5, 5, 9, 9, 10, 8, 10, 4, 2, 0, 2, 4, 10, 8, 10, 11, 11, 11, 11, 3, 3, 3, 3, 11, 11, 11, 11, 12, 10, 8, 10, 12, 2, 0, 2, 12, 10, 8, 10, 12, 13, 13, 9, 9, 13, 13, 1, 1, 13, 13, 9, 9, 13, 13
Offset: 0

Views

Author

Keywords

Comments

Another way to construct the array: construct an infinite square matrix starting in the top left corner using the rule that each entry is the smallest nonnegative number that is not in the row to your left or in the column above you.
After a few moves the [symmetric] matrix looks like this:
0 1 2 3 4 5 ...
1 0 3 2 5 ...
2 3 0 1 ?
3 2 1
4 5 ?
5
The ? is then replaced with a 6.

Examples

			Table begins
   0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, ...
   1,  0,  3,  2,  5,  4,  7,  6,  9,  8, 11, 10, ...
   2,  3,  0,  1,  6,  7,  4,  5, 10, 11,  8, ...
   3,  2,  1,  0,  7,  6,  5,  4, 11, 10, ...
   4,  5,  6,  7,  0,  1,  2,  3, 12, ...
   5,  4,  7,  6,  1,  0,  3,  2, ...
   6,  7,  4,  5,  2,  3,  0, ...
   7,  6,  5,  4,  3,  2, ...
   8,  9, 10, 11, 12, ...
   9,  8, 11, 10, ...
  10, 11,  8, ...
  11, 10, ...
  12, ...
  ...
The first few antidiagonals are
   0;
   1,  1;
   2,  0,  2;
   3,  3,  3,  3;
   4,  2,  0,  2,  4;
   5,  5,  1,  1,  5,  5;
   6,  4,  6,  0,  6,  4,  6;
   7,  7,  7,  7,  7,  7,  7,  7;
   8,  6,  4,  6,  0,  6,  4,  6,  8;
   9,  9,  5,  5,  1,  1,  5,  5,  9,  9;
  10,  8, 10,  4,  2,  0,  2,  4, 10,  8, 10;
  11, 11, 11, 11,  3,  3,  3,  3, 11, 11, 11, 11;
  12, 10,  8, 10, 12,  2,  0,  2, 12, 10,  8, 10, 12;
  ...
[Symmetric] matrix in base 2:
     0    1   10   11  100  101,  110  111 1000 1001 1010 1011 ...
     1    0   11   10  101  100,  111  110 1001 1000 1011  ...
    10   11    0    1  110  111,  100  101 1010 1011  ...
    11   10    1    0  111  110,  101  100 1011  ...
   100  101  110  111    0    1    10   11  ...
   101  100  111  110    1    0    11  ...
   110  111  100  101   10   11   ...
   111  110  101  100   11  ...
  1000 1001 1010 1011  ...
  1001 1000 1011  ...
  1010 1011  ...
  1011  ...
   ...
		

References

  • E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 60.
  • J. H. Conway, On Numbers and Games. Academic Press, NY, 1976, pp. 51-53.
  • Eric Friedman, Scott M. Garrabrant, Ilona K. Phipps-Morgan, A. S. Landsberg and Urban Larsson, Geometric analysis of a generalized Wythoff game, in Games of no Chance 5, MSRI publ. Cambridge University Press, date?
  • D. Gale, Tracking the Automatic Ant and Other Mathematical Explorations, A Collection of Mathematical Entertainments Columns from The Mathematical Intelligencer, Springer, 1998; see p. 190. [From N. J. A. Sloane, Jul 14 2009]
  • R. K. Guy, Impartial games, pp. 35-55 of Combinatorial Games, ed. R. K. Guy, Proc. Sympos. Appl. Math., 43, Amer. Math. Soc., 1991.

Crossrefs

Initial rows are A001477, A004442, A004443, A004444, etc. Cf. A051775, A051776.
Cf. A003986 (OR), A004198 (AND), A221146 (carries).
Antidiagonal sums are in A006582.

Programs

  • Maple
    nimsum := proc(a,b) local t1,t2,t3,t4,l; t1 := convert(a+2^20,base,2); t2 := convert(b+2^20,base,2); t3 := evalm(t1+t2); map(x->x mod 2, t3); t4 := convert(evalm(%),list); l := convert(t4,base,2,10); sum(l[k]*10^(k-1), k=1..nops(l)); end; # memo: adjust 2^20 to be much bigger than a and b
    AT := array(0..N,0..N); for a from 0 to N do for b from a to N do AT[a,b] := nimsum(a,b); AT[b,a] := AT[a,b]; od: od:
    # alternative:
    read("transforms") :
    A003987 := proc(n,m)
        XORnos(n,m) ;
    end proc: # R. J. Mathar, Apr 17 2013
    seq(seq(Bits:-Xor(k,m-k),k=0..m),m=0..20); # Robert Israel, Dec 31 2015
  • Mathematica
    Flatten[Table[BitXor[b, a - b], {a, 0, 10}, {b, 0, a}]] (* BitXor and Nim Sum are equivalent *)
  • PARI
    tabl(nn) = {for(n=0, nn, for(k=0, n, print1(bitxor(k, n - k),", ");); print(););};
    tabl(13) \\ Indranil Ghosh, Mar 31 2017
    
  • Python
    for n in range(14):
        print([k^(n - k) for k in range(n + 1)]) # Indranil Ghosh, Mar 31 2017

Formula

T(2i,2j) = 2T(i,j), T(2i+1,2j) = 2T(i,j) + 1.

A016945 a(n) = 6*n+3.

Original entry on oeis.org

3, 9, 15, 21, 27, 33, 39, 45, 51, 57, 63, 69, 75, 81, 87, 93, 99, 105, 111, 117, 123, 129, 135, 141, 147, 153, 159, 165, 171, 177, 183, 189, 195, 201, 207, 213, 219, 225, 231, 237, 243, 249, 255, 261, 267, 273, 279, 285, 291, 297, 303, 309, 315, 321, 327
Offset: 0

Views

Author

Keywords

Comments

Apart from initial term(s), dimension of the space of weight 2n cuspidal newforms for Gamma_0(37).
Continued fraction expansion of tanh(1/3).
If a 2-set Y and a 3-set Z are disjoint subsets of an n-set X then a(n-4) is the number of 3-subsets of X intersecting both Y and Z. - Milan Janjic, Sep 08 2007
Leaves of the Odd Collatz-Tree: a(n) has no odd predecessors in all '3x+1' trajectories where it occurs: A139391(2*k+1) <> a(n) for all k; A082286(n)=A006370(a(n)). - Reinhard Zumkeller, Apr 17 2008
Let random variable X have a uniform distribution on the interval [0,c] where c is a positive constant. Then, for positive integer n, the coefficient of determination between X and X^n is (6n+3)/(n+2)^2, that is, A016945(n)/A000290(n+2). Note that the result is independent of c. For the derivation of this result, see the link in the Links section below. - Dennis P. Walsh, Aug 20 2013
Positions of 3 in A020639. - Zak Seidov, Apr 29 2015
a(n+2) gives the sum of 6 consecutive terms of A004442 starting with A004442(n). - Wesley Ivan Hurt, Apr 08 2016
Numbers k such that Fibonacci(k) mod 4 = 2. - Bruno Berselli, Oct 17 2017
Also numbers k such that t^k == -1 (mod 7), where t is a member of A047389. - Bruno Berselli, Dec 28 2017

Crossrefs

Third row of A092260.
Subsequence of A061641; complement of A047263; bisection of A047241.
Cf. A000225. - Loren Pearson, Jul 02 2009
Cf. A020639. - Zak Seidov, Apr 29 2015
Odd numbers in A355200.

Programs

Formula

a(n) = 3*(2*n + 1) = 3*A005408(n), odd multiples of 3.
A008615(a(n)) = n. - Reinhard Zumkeller, Feb 27 2008
A157176(a(n)) = A103333(n+1). - Reinhard Zumkeller, Feb 24 2009
a(n) = 12*n - a(n-1) for n>0, a(0)=3. - Vincenzo Librandi, Nov 20 2010
G.f.: 3*(1+x)/(1-x)^2. - Mario C. Enriquez, Dec 14 2016
E.g.f.: 3*(1 + 2*x)*exp(x). - G. C. Greubel, Sep 18 2019
Sum_{n>=0} (-1)^n/a(n) = Pi/12 (A019679). - Amiram Eldar, Dec 10 2021
From Amiram Eldar, Nov 22 2024: (Start)
Product_{n>=0} (1 - (-1)^n/a(n)) = sqrt(2)/2 (A010503).
Product_{n>=0} (1 + (-1)^n/a(n)) = sqrt(3/2) (A115754). (End)
a(n) = (n+2)^2 - (n-1)^2. - Alexander Yutkin, Mar 15 2025

A017101 a(n) = 8n + 3.

Original entry on oeis.org

3, 11, 19, 27, 35, 43, 51, 59, 67, 75, 83, 91, 99, 107, 115, 123, 131, 139, 147, 155, 163, 171, 179, 187, 195, 203, 211, 219, 227, 235, 243, 251, 259, 267, 275, 283, 291, 299, 307, 315, 323, 331, 339, 347, 355, 363, 371, 379, 387, 395, 403, 411, 419, 427
Offset: 0

Views

Author

Keywords

Comments

Apart from initial term(s), dimension of the space of weight 2n cusp forms for Gamma_0( 47 ).
Also numbers of the form x^2 + y^2 + z^2, where x,y,z are odd integers. - Alexander Adamchuk, Dec 01 2006
Conjecture: 2*a(n) is the half-period of oscillation of a Langton's ant colony that is n basic blocks in length. To construct such blocks use a pair of ants facing north at (x,y) and (x+1,y+2) (using Golly's coordinate system). Each successive block is placed 1 cell away from the previous one, i.e., the x coordinate shifts by 3, so we have (x+3k,y) and (x+3k+1,y+2). Also, because of the symmetry of the oscillation pattern, 4*a(n) is the length of the whole period (see MathOverflow link for details). - Mikhail Kurkov, Nov 20 2019

References

  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 247.

Crossrefs

Programs

Formula

a(n) = A001969(2*n+1) + A001969(2*n) = A000069(2*n+1) + A000069(2*n). - Philippe Deléham, Feb 04 2004
G.f.: (3+5*x)/(1-x)^2. - R. J. Mathar, Mar 30 2011
a(n) = 2*a(n-1) - a(n-2) for n>1. - Vincenzo Librandi, May 28 2011
a(A002265(n)) = A004442(n) + A004443(n). - Wesley Ivan Hurt, Apr 06 2016
E.g.f.: exp(x)*(3 + 8*x). - Stefano Spezia, Nov 20 2019
a(n) = A004767(2*n), for n >= 0. See also A004767(2*n+1) = A004771(n). - Wolfdieter Lang, Feb 03 2022

A103889 Odd and even positive integers swapped.

Original entry on oeis.org

2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, 17, 20, 19, 22, 21, 24, 23, 26, 25, 28, 27, 30, 29, 32, 31, 34, 33, 36, 35, 38, 37, 40, 39, 42, 41, 44, 43, 46, 45, 48, 47, 50, 49, 52, 51, 54, 53, 56, 55, 58, 57, 60, 59, 62, 61, 64, 63, 66, 65, 68, 67, 70, 69, 72, 71
Offset: 1

Views

Author

Zak Seidov, Feb 20 2005

Keywords

Comments

For n >= 5, also the number of (undirected) Hamiltonian cycles in the (n-2)-Moebius ladder. - Eric W. Weisstein, May 06 2019
For n >= 4, also the number of (undirected) Hamiltonian cycles in the (n-1)-prism graph. - Eric W. Weisstein, May 06 2019
The lexicographically first involution of the natural numbers with no fixed points. - Alexander Fraebel, Sep 08 2020

Crossrefs

Essentially the same as A014681.
Odd numbers: A005408. Even numbers: A005843.
Cf. A004442.

Programs

  • Haskell
    import Data.List (transpose)
    a103889 n = n - 1 + 2 * mod n 2
    a103889_list = concat $ transpose [tail a005843_list, a005408_list]
    -- Reinhard Zumkeller, Jun 23 2013, Feb 21 2011
    
  • Magma
    [n eq 1 select 2 else -Self(n-1)+2*n-1: n in [1..72]];
    
  • Mathematica
    Table[{n + 1, n}, {n, 1, 100, 2}] // Flatten
    Table[n - (-1)^n, {n, 25}] (* Eric W. Weisstein, May 06 2019 *)
  • PARI
    a(n)=n-1+if(n%2,2) \\ Charles R Greathouse IV, Feb 24 2011
    
  • Python
    def a(n): return n+1 if n&1 else n-1
    print([a(n) for n in range(1, 73)]) # Michael S. Branicky, May 03 2023

Formula

a(2k) = 2k-1 = A005408(k), a(2k-1) = 2k = A005843(k), k=1, 2, ...
O.g.f.: x*(x^2-x+2)/((x-1)^2*(1+x)). - R. J. Mathar, Apr 06 2008
a(n) = n-1+2*(n mod 2). - Rolf Pleisch, Apr 22 2008
a(n) = 2*n-a(n-1)-1 (with a(1)=2). - Vincenzo Librandi, Nov 16 2010
From Bruno Berselli, Nov 16 2010: (Start)
a(n) = n - (-1)^n.
a(n) - a(n-1) - a(n-2) + a(n-3) = 0 for n > 3.
(a(n) - 1)*(a(n-1) + 1) = 2*A176222(n+1) for n > 1.
(a(n) - 1)*(a(n-3) + 1) = 2*A176222(n) for n > 3. (End)
E.g.f.: 1 - exp(-x) + x*exp(x). - Stefano Spezia, May 03 2023

A014681 Fix 0; exchange even and odd numbers.

Original entry on oeis.org

0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, 17, 20, 19, 22, 21, 24, 23, 26, 25, 28, 27, 30, 29, 32, 31, 34, 33, 36, 35, 38, 37, 40, 39, 42, 41, 44, 43, 46, 45, 48, 47, 50, 49, 52, 51, 54, 53, 56, 55, 58, 57, 60, 59, 62, 61, 64, 63, 66, 65, 68, 67, 70
Offset: 0

Views

Author

Keywords

Comments

A self-inverse permutation of the nonnegative numbers.
If we ignore the first term 0, then this can be obtained as: a(n) is the smallest number different from n, not occurring earlier and coprime to n. - Amarnath Murthy, Apr 16 2003 [Corrected by Alois P. Heinz, May 06 2015]
a(0)=0, a(1)=2, then repeatedly subtract 1 and then add 3. - Jon Perry, Aug 12 2014
The biggest term of the pair [a(n), a(n+1)] is always even. This is the lexicographically first sequence with this property starting with a(1) = 0 and always extented with the smallest integer not yet present. - Eric Angelini, Feb 20 2017

Crossrefs

Composing this permutation with A065190 gives A065164.
Equals 1 + A004442.
Cf. A103889.

Programs

  • Mathematica
    Table[n - (-1)^n, {n, 1, 60}]
    Join[{0},LinearRecurrence[{1, 1, -1},{2, 1, 4},69]] (* Ray Chandler, Sep 03 2015 *)
  • PARI
    a(n)=n - (-1)^n \\ Charles R Greathouse IV, May 06 2015

Formula

G.f.: x*(2-x+x^2)/((1-x)*(1-x^2)). - N. J. A. Sloane
a(n) = n - (-1)^n = a(n-1) + a(n-2) - a(n-3) = a(n-2) + 2. - Henry Bottomley, Mar 29 2000
a(0) = 0; a(2m+1) = 2m+2; for m > 0 a(2m) = 2m - 1. - George E. Antoniou, Dec 04 2001
a(n) = n - (-1)^n + 0^n for n >= 0. - Bruno Berselli, Nov 16 2010
E.g.f.: 1 + (x - 1)*cosh(x) + (1 + x)*sinh(x). - Stefano Spezia, Sep 02 2022

A065190 Self-inverse permutation of the positive integers: 1 is fixed, followed by an infinite number of adjacent transpositions (n n+1).

Original entry on oeis.org

1, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28, 31, 30, 33, 32, 35, 34, 37, 36, 39, 38, 41, 40, 43, 42, 45, 44, 47, 46, 49, 48, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 61, 60, 63, 62, 65, 64, 67, 66, 69, 68, 71, 70, 73
Offset: 1

Views

Author

Antti Karttunen, Oct 19 2001

Keywords

Comments

Also, a lexicographically minimal sequence of distinct positive integers such that a(n) is coprime to n. - Ivan Neretin, Apr 18 2015
The larger term of the pair (a(n), a(n+1)) is always odd. Had we started the sequence with a(1) = 0, it would be the lexicographically first sequence with this property if always extented with the smallest integer not yet present. - Eric Angelini, Feb 17 2017
From Yosu Yurramendi, Mar 21 2017: (Start)
This sequence is self-inverse. Except for the fixed point 1, it consists completely of 2-cycles: (2n, 2n+1), n > 0.
A020651(a(n)) = A020650(n), A020650(a(n)) = A020651(n), n > 0.
A245327(a(n)) = A245328(n), A245328(a(n)) = A245327(n), n > 0.
A063946(a(n)) = a(A063946(n)), n > 0.
A054429(a(n)) = a(A054429(n)) = A092569(n), n > 0.
A258996(a(n)) = a(A258996(n)), n > 0.
A258746(a(n)) = a(A258746(n)), n > 0. (End)
From Enrique Navarrete, Nov 13 2017: (Start)
With a(0)=0, and the rest of the sequence appended, a(n) is the smallest positive number not yet in the sequence such that the arithmetic mean of the first n+1 terms a(0), a(1), ..., a(n) is not an integer; i.e., the sequence is 0, 1, 3, 2, 5, 4, 7, 6, 9, 8, ...
Example: for n=5, (0 + 1 + 3 + 2 + 5)/5 is not an integer.
Fixed points are odd numbers >= 3 and also a(n) = n-2 for even n >= 4. (End)

Crossrefs

Programs

  • Magma
    [1] cat [n+(-1)^n: n in [2..80]]; // Vincenzo Librandi, Apr 18 2015
    
  • Maple
    [seq(f(j),j=1..120)]; f := (n) -> `if`((n < 2), n,n+((-1)^n));
  • Mathematica
    f[n_] := Rest@ Flatten@ Transpose[{Range[1, n + 1, 2], {1}~Join~Range[2, n, 2]}]; f@ 72 (* Michael De Vlieger, Apr 18 2015 *)
    Rest@ CoefficientList[Series[x (x^3 - 2 x^2 + 2 x + 1)/((x - 1)^2*(x + 1)), {x, 0, 72}], x] (* Michael De Vlieger, Feb 17 2017 *)
    Join[{1},LinearRecurrence[{1,1,-1},{3,2,5},80]] (* Harvey P. Dale, Feb 24 2021 *)
  • PARI
    { for (n=1, 1000, if (n>1, a=n + (-1)^n, a=1); write("b065190.txt", n, " ", a) ) } \\ Harry J. Smith, Oct 13 2009
    
  • PARI
    x='x+O('x^100); Vec(x*(x^3-2*x^2+2*x+1)/((x-1)^2*(x+1))) \\ Altug Alkan, Feb 04 2016
    
  • Python
    def a(n): return 1 if n<2 else n + (-1)**n # Indranil Ghosh, Mar 22 2017
    
  • R
    maxrow <- 8 # by choice
    a <- c(1,3,2) # If it were c(1,2,3), it would be A000027
      for(m in 1:maxrow) for(k in 0:(2^m-1)){
    a[2^(m+1)+    k] = a[2^m+k] + 2^m
    a[2^(m+1)+2^m+k] = a[2^m+k] + 2^(m+1)
    }
    a
    # Yosu Yurramendi, Apr 10 2017

Formula

a(1) = 1, a(n) = n+(-1)^n.
From Colin Barker, Feb 18 2013: (Start)
a(n) = a(n-1) + a(n-2) - a(n-3) for n>4.
G.f.: x*(x^3 - 2*x^2 + 2*x + 1) / ((x-1)^2*(x+1)). (End)
a(n)^a(n) == 1 (mod n). - Thomas Ordowski, Jan 04 2016
E.g.f.: x*(1+exp(x)) - 1 + exp(-x). - Robert Israel, Feb 04 2016
a(n) = A014681(n-1) + 1. - Michel Marcus, Dec 10 2016
a(1) = 1, for n > 0 a(2*n) = 2*a(a(n)) + 1, a(2*n + 1) = 2*a(a(n)). - Yosu Yurramendi, Dec 12 2020

A063946 Write n in binary and complement second bit (from the left), with a(0)=0 and a(1)=1.

Original entry on oeis.org

0, 1, 3, 2, 6, 7, 4, 5, 12, 13, 14, 15, 8, 9, 10, 11, 24, 25, 26, 27, 28, 29, 30, 31, 16, 17, 18, 19, 20, 21, 22, 23, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 96, 97, 98, 99, 100, 101, 102
Offset: 0

Views

Author

Henry Bottomley, Sep 03 2001

Keywords

Comments

From Yosu Yurramendi, Mar 21 2017: (Start)
This sequence is a self-inverse permutation of the integers. Except for fixed points 0, 1, it consists completely of 2-cycles: (2^(m+1)+k, 2^(m+1)+2^m+k), m >= 0, 0 <= k < 2^m.
A071766(a(n)) = A229742(n), A229742(a(n)) = A071766(n), n > 0.
A245325(a(n)) = A245326(n), A245326(a(n)) = A245325(n), n > 0.
A065190(a(n)) = a(A065190(n)), n > 0.
A054429(a(n)) = a(A054429(n)) = A117120(n), n > 0.
A258746(a(n)) = a(A258746(n)), n > 0.
A258996(a(n)) = a(A258996(n)), n > 0. (End)
A324337(a(n)) = A324338(n), A324338(a(n)) = A324337(n), n > 0. - Yosu Yurramendi, Nov 04 2019

Examples

			a(11)=15 since 11 is written in binary as 1011, which changes to 1111, i.e., 15; a(12)=8 since 12 is written as 1100 which changes to 1000, i.e., 8.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember;
      if n<2 then n
    elif n<4 then 5-n
    elif `mod`(n,2)=0 then 2*a(n/2)
    else 2*a((n-1)/2) + 1
      fi; end proc;
    seq(a(n), n = 0..80); # G. C. Greubel, Dec 08 2019
  • Mathematica
    bc[n_]:=Module[{idn2=IntegerDigits[n,2]},If[idn2[[2]]==1,idn2[[2]]=0, idn2[[2]]=1];FromDigits[idn2,2]]; Join[{0,1},Array[bc,80,2]] (* Harvey P. Dale, May 31 2012 *)
    a[n_]:= a[n]= If[n<2, n, If[n<4, 5-n, If[EvenQ[n], 2*a[n/2], 2*a[(n-1)/2] +1]]];  Table[a[n], {n,0,80}] (* G. C. Greubel, Dec 08 2019 *)
  • PARI
    a(n)=if(n<2,n>0,3/2*2^floor(log(n)/log(2))-2^floor(log(4/3*n)/log(2))+n) /* Ralf Stephan */
    
  • PARI
    a(n) = if(n<2,n, bitxor(n, 1<<(logint(n,2)-1))); \\ Kevin Ryde, Apr 09 2020
    
  • Python
    import math
    def a(n): return n if n<2 else 3/2*2**int(math.floor(math.log(n)/math.log(2))) - 2**int(math.floor(math.log(4/3*n)/math.log(2))) + n # Indranil Ghosh, Mar 22 2017
    
  • R
    maxrow <- 8 # by choice
    b01 <- 1
    for(m in 0:(maxrow-1)){
      b01 <- c(b01,rep(0,2^(m+1))); b01[2^(m+1):(2^(m+1)+2^m-1)] <- 1
    }
    a <- c(1,3,2)
    for(m in 0:(maxrow-2))
      for(k in 0:(2^m-1)){
        a[2^(m+2) +                 k] <- a[2^(m+1) + 2^m + k] + 2^((m+1) + b01[2^(m+2) +                 k])
        a[2^(m+2) +         + 2^m + k] <- a[2^(m+1) +       k] + 2^((m+1) + b01[2^(m+2) +         + 2^m + k])
        a[2^(m+2) + 2^(m+1) +       k] <- a[2^(m+1) + 2^m + k] + 2^((m+1) + b01[2^(m+2) + 2^(m+1) +       k])
        a[2^(m+2) + 2^(m+1) + 2^m + k] <- a[2^(m+1) +       k] + 2^((m+1) + b01[2^(m+2) + 2^(m+1) + 2^m + k])
    }
    (a <- c(0,a))  # Yosu Yurramendi, Mar 30 2017
    
  • R
    a <- c(1,3,2)
    maxn <- 63 # by choice
    for(n in 2:maxn){ a[2*n  ] <- 2*a[n]
                      a[2*n+1] <- 2*a[n] + 1  }
    (a <- c(0,a))  # Yosu Yurramendi, Nov 12 2019
    
  • Sage
    @CachedFunction
    def a(n):
        if (n<2): return n
        elif (n<4): return 5-n
        elif (mod(n,2)==0): return 2*a(n/2)
        else: return 2*a((n-1)/2) + 1
    [a(n) for n in (0..80)] # G. C. Greubel, Dec 08 2019

Formula

If 2*2^k <= n < 3*2^k then a(n) = n + 2^k; if 3*2^k <= n < 4*2^k then a(n) = n - 2^k.
a(0)=0, a(1)=1, a(2)=3, a(3) = 2, a(2n) = 2*a(n), a(2n+1) = 2*a(n) + 1. - Ralf Stephan, Aug 23 2003

A004443 Nimsum n + 2.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

A self-inverse permutation of the natural numbers. - Philippe Deléham, Nov 22 2016

References

  • E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 60.
  • J. H. Conway, On Numbers and Games. Academic Press, NY, 1976, pp. 51-53.

Crossrefs

Essentially the same as A256008 - 1.
Also the second column of A274528.
Cf. A002162.

Programs

  • Maple
    nimsum := proc(a,b) local t1,t2,t3,t4,l; t1 := convert(a+2^200,base,2); t2 := convert(b+2^200,base,2); t3 := evalm(t1+t2); map(x->x mod 2, t3); t4 := convert(evalm(%),list); l := convert(t4,base,2,10); sum(l[k]*10^(k-1), k=1..nops(l)); end;
    f := n -> n + 2*(-1)^floor(n/2); # N. J. A. Sloane, Jul 06 2019
  • Mathematica
    Table[BitXor[n, 2], {n, 0, 100}] (* T. D. Noe, Feb 09 2013 *)
  • PARI
    a(n)=bitxor(n,2) \\ Charles R Greathouse IV, Oct 07 2015
    
  • Python
    for n in range(20): print(2^n) # Oliver Knill, Feb 16 2020

Formula

a(n) = n XOR 2. - Joerg Arndt, Feb 07 2013
G.f.: (2-x-2x^2+3x^3)/((1-x)^2(1+x^2)). - Ralf Stephan, Apr 24 2004
The sequences 'Nimsum n + m' seem to have the general o.g.f. p(x)/q(x) with p, q polynomials and q(x) = (1-x)^2*Product_{k>=0} (1+x^(2^e(k))), with Sum_{k>=0} 2^e(k) = m. - Ralf Stephan, Apr 24 2004
a(n) = n + 2(-1)^floor(n/2). - Mitchell Harris, Jan 10 2005
a(n) = OR(n,2) - AND(n,2). - Gary Detlefs, Feb 06 2013
E.g.f.: 2*(sin(x) + cos(x)) + x*exp(x). - Ilya Gutkovskiy, Jul 01 2016
Sum_{n>=0,n<>2} (-1)^n/a(n) = -log(2) = -A002162. - Peter McNair, Aug 07 2023

A080412 Exchange rightmost two binary digits of n > 1; a(0)=0, a(1)=2.

Original entry on oeis.org

0, 2, 1, 3, 4, 6, 5, 7, 8, 10, 9, 11, 12, 14, 13, 15, 16, 18, 17, 19, 20, 22, 21, 23, 24, 26, 25, 27, 28, 30, 29, 31, 32, 34, 33, 35, 36, 38, 37, 39, 40, 42, 41, 43, 44, 46, 45, 47, 48, 50, 49, 51, 52, 54, 53, 55, 56, 58, 57, 59, 60, 62, 61, 63, 64, 66, 65, 67, 68, 70, 69, 71, 72
Offset: 0

Views

Author

Reinhard Zumkeller, Feb 17 2003

Keywords

Comments

Self-inverse permutation of the natural numbers: a(a(n)) = n.
Lodumo_2 of A021913. - Philippe Deléham, Apr 26 2009
The lodumo_m transformation of a list L is the list L' such that L'(n) is the smallest nonnegative integer not occurring earlier in L' and equal to L(n) (mod m). - M. F. Hasler, Dec 06 2010
From Franck Maminirina Ramaharo, Jul 20 2018: (Start)
Let
A: 0, 3, 8, 11, 16, 19, 24, 27, 32, 35, 40, 43, 48, 51, 56, 59, ... A047470
B: 1, 6, 9, 14, 17, 22, 25, 30, 33, 38, 41, 46, 49, 54, 57, 62, ... A047452
C: 2, 5, 10, 13, 18, 21, 26, 29, 34, 37, 42, 45, 50, 53, 58, 61, ... A047617
D: 4, 7, 12, 15, 20, 23, 28, 31, 36, 39, 44, 47, 52, 55, 60, 63, ... A047535.
Then the sequence is obtained by repeatedly picking terms from A,B,C,D according to the circuit A-C-B-A-D-B-C-D. The sequence begins:
A | C | B | A | D | B | C | D || A | C | B | A | D | ...
--+---+---+---+---+---+---+---++---+---+---+---+---+----
0 | 2 | 1 | 3 | 4 | 6 | 5 | 7 || 8 |10 | 9 |11 |12 | ...
(End)
The sequence is a permutation of the nonnegative integers partitioned into quadruples [4k, 4k+2, 4k+1, 4k+3] for k >= 0, i.e., the two interior terms of each quadruple are interchanged. - Guenther Schrack, Apr 22 2019

Examples

			a(20) = a('101'00') = '101'00' = 20; a(21) = a('101'01') = '101'10' = 22.
a(2) = a('10') = '01' = 1; a(3) = a('11') = '11' = 3.
		

Crossrefs

Programs

  • GAP
    a:=[0,2,1,3,4];; for n in [6..80] do a[n]:=a[n-1]+a[n-4]-a[n-5]; od; a; # Muniru A Asiru, Jul 27 2018
    
  • Magma
    R:=PowerSeriesRing(Integers(), 80); [0] cat Coefficients(R!( x*(2-x+2*x^2+x^3)/((1-x)*(1-x^4)) )); // G. C. Greubel, Apr 28 2019
    
  • Maple
    A080412:=n->n+1+(1+I)*(2*I-2-(1-I)*I^(2*n)+I^(-n)-I^(1+n))/4: seq(A080412(n), n=0..100); # Wesley Ivan Hurt, May 28 2016
  • Mathematica
    a[n_] := (bits = IntegerDigits[n, 2]; Join[Drop[bits, -2], {bits[[-1]], bits[[-2]]}] // FromDigits[#, 2]&); a[0]=0; a[1]=2; Table[a[n], {n, 0, 80}] (* Jean-François Alcover, Mar 11 2013 *)
    ertbd[n_]:=Module[{a,b},{a,b}=TakeDrop[IntegerDigits[n,2], IntegerLength[ n,2]-2];FromDigits[Join[a,Reverse[b]],2]]; Join[{0,2},Array[ertbd,80,2]] (* The program uses the TakeDrop function from Mathematica version 10 *) (* Harvey P. Dale, Jan 07 2016 *)
    CoefficientList[Series[x*(2-x+2*x^2+x^3)/((1-x)*(1-x^4)), {x,0,80}], x] (* G. C. Greubel, Apr 28 2019 *)
  • PARI
    my(x='x+O('x^80)); concat([0], Vec(x*(2-x+2*x^2+x^3)/((1-x)*(1-x^4)))) \\ G. C. Greubel, Apr 28 2019
    
  • Python
    def A080412(n): return (0,1,-1,0)[n&3]+n # Chai Wah Wu, Jan 18 2023
  • Sage
    (x*(2-x+2*x^2+x^3)/((1-x)*(1-x^4))).series(x, 80).coefficients(x, sparse=False) # G. C. Greubel, Apr 28 2019
    

Formula

a(n) = 4*floor(n/4) + a(n mod 4), for n > 3.
a(n) = a(n-1) + a(n-4) - a(n-5) for n > 4. - Joerg Arndt, Mar 11 2013
a(n) = lod_2(A021913(n)). - Philippe Deléham, Apr 26 2009
From Wesley Ivan Hurt, May 28 2016: (Start)
a(n) = n + 1 + (1+i)*(2*i-2-(1-i)*i^(2*n) + i^(-n)-i^(1+n))/4 where i=sqrt(-1).
G.f.: x*(2-x+2*x^2+x^3) / ((1-x)^2*(1+x+x^2+x^3)). (End)
E.g.f.: (sin(x) + cos(x) + (2*x + 1)*sinh(x) + (2*x - 1)*cosh(x))/2. - Ilya Gutkovskiy, May 28 2016
From Guenther Schrack, Apr 23 2019: (Start)
a(n) = (2*n - (-1)^n + (-1)^(n*(n-1)/2))/2.
a(n) = a(n-4) + 4, a(0)=0, a(1)=2, a(2)=1, a(3)=3, for n > 3. (End)

Extensions

Typo in example fixed by Reinhard Zumkeller, Jul 06 2009
Showing 1-10 of 54 results. Next