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

A064433 Number of iterations of A064455 to reach 2 (or 1 in the case of 1).

Original entry on oeis.org

1, 1, 2, 6, 3, 5, 7, 12, 4, 14, 6, 11, 8, 8, 13, 13, 5, 10, 15, 15, 7, 7, 12, 12, 9, 17, 9, 71, 14, 14, 14, 68, 6, 19, 11, 11, 16, 16, 16, 24, 8, 70, 8, 21, 13, 13, 13, 67, 10, 18, 18, 18, 10, 10, 72, 72, 15, 23, 15, 23, 15, 15, 69, 69, 7, 20, 20, 20, 12, 12, 12, 66, 17, 74, 17
Offset: 1

Views

Author

Jonathan Ayres (Jonathan.ayres(AT)btinternet.com), Oct 01 2001

Keywords

Comments

Similar to 3x+1 series (A008908). Does this sequence converge to 2 for all values of n (true for all values of n up to 100000)? The inverse sequence using next n = n-int(n/2) for n even and n+int(n/2) for n odd leads to 3 (?) possible end sequences (1), (5, 7, 10) and (17, 25, 37, 55, 82, 41, 61, 91, 136, 68, 34)
Starting with a number n, the next value generated is n+int(n/2) if n is even, n-int(n/2) if n is odd; a(n) is the number of iteration for the initial value n to reach the limit of 1 to 2
Collatz's 3N+1 function as isometry over the dyadics is N->N/2 if even, but N->(3N+1)/2 if odd, including the (necessary) halving into each tripling step. Counting steps until reaching 1 in this way leads to this sequence instead of A008908. - Michael Vielhaber (vielhaber(AT)gmail.com), Nov 18 2009
The value at each step of a trajectory starting with n (n>1) is equal to the value plus one at the same step of the row starting with (n-1) of the irregular triangle of the abbreviated (Terras-modified) Collatz sequence (A070168). - K. Spage, Aug 07 2014

Examples

			a(4) = 6. Starting with 4, 4 is even so the next number is 4+int(4/2) = 6, 6 is even so next number is 6+int(6/2) = 9, 9 is odd so next number is 9-int(9/2) = 5, 5 is odd so next number is 5-int(5/2) = 3, 3 is odd so next number is 3-int(3/2)=2, so giving a sequence of 4,6,9,5,3,2: 6 numbers.
a(5) = 3. Starting with 5, A064455(5) = 3, A064455(3) = 2, so giving a trajectory of 5,3,2: 3 numbers. - _K. Spage_, Aug 07 2014
		

Crossrefs

Programs

  • Mathematica
    Table[Length@ NestWhileList[If[EvenQ@ #, 3 #/2, (# + 1)/2] &, n, # != 1 + Boole[n > 1] &], {n, 75}] (* Michael De Vlieger, Sep 24 2016 *)
  • PARI
    A064455(n) = {if(n%2, (n + 1)/2, 3*n/2)}
    A064433(n) = {my(c=1); if(n==1, 1, while(n!=2, n=A064455(n); c++); c)} \\ K. Spage, Aug 07 2014

Formula

a(n) = A006666(n-1) + 1. - K. Spage, Aug 04 2014

A014682 The Collatz or 3x+1 function: a(n) = n/2 if n is even, otherwise (3n+1)/2.

Original entry on oeis.org

0, 2, 1, 5, 2, 8, 3, 11, 4, 14, 5, 17, 6, 20, 7, 23, 8, 26, 9, 29, 10, 32, 11, 35, 12, 38, 13, 41, 14, 44, 15, 47, 16, 50, 17, 53, 18, 56, 19, 59, 20, 62, 21, 65, 22, 68, 23, 71, 24, 74, 25, 77, 26, 80, 27, 83, 28, 86, 29, 89, 30, 92, 31, 95, 32, 98, 33, 101, 34, 104
Offset: 0

Views

Author

Keywords

Comments

This is the function usually denoted by T(n) in the literature on the 3x+1 problem. See A006370 for further references and links.
Intertwining of sequence A016789 '2,5,8,11,... ("add 3")' and the nonnegative integers.
a(n) = log_2(A076936(n)). - Amarnath Murthy, Oct 19 2002
The average value of a(0), ..., a(n-1) is A004526(n). - Amarnath Murthy, Oct 19 2002
Partial sums are A093353. - Paul Barry, Mar 31 2008
Absolute first differences are essentially in A014681 and A103889. - R. J. Mathar, Apr 05 2008
Only terms of A016789 occur twice, at positions given by sequences A005408 (odd numbers) and A016957 (6n+4): (1,4), (3,10), (5,16), (7,22), ... - Antti Karttunen, Jul 28 2017
a(n) represents the unique congruence class modulo 2n+1 that is represented an odd number of times in any 2n+1 consecutive oblong numbers (A002378). This property relates to Jim Singh's 2018 formula, as n^2 + n is a relevant oblong number. - Peter Munn, Jan 29 2022

Examples

			a(3) = -3*(-1) - 2*1 - 1*(-1) - 0*1 + 1*(-1) + 2*1 + 3*(-1) + 4*1 + 5*(-1) + 6*1 = 5. - _Bruno Berselli_, Dec 14 2015
		

References

  • J. C. Lagarias, ed., The Ultimate Challenge: The 3x+1 Problem, Amer. Math. Soc., 2010.

Crossrefs

Programs

  • Haskell
    a014682 n = if r > 0 then div (3 * n + 1) 2 else n'
                where (n', r) = divMod n 2
    -- Reinhard Zumkeller, Oct 03 2014
    
  • Magma
    [IsOdd(n) select (3*n+1)/2 else n/2: n in [0..52]]; // Vincenzo Librandi, Sep 28 2018
  • Maple
    T:=proc(n) if n mod 2 = 0 then n/2 else (3*n+1)/2; fi; end; # N. J. A. Sloane, Jan 31 2011
    A076936 := proc(n) option remember ; local apr,ifr,me,i,a ; if n <=2 then n^2 ; else apr := mul(A076936(i),i=1..n-1) ; ifr := ifactors(apr)[2] ; me := -1 ; for i from 1 to nops(ifr) do me := max(me, op(2,op(i,ifr))) ; od ; me := me+ n-(me mod n) ; a := 1 ; for i from 1 to nops(ifr) do a := a*op(1,op(i,ifr))^(me-op(2,op(i,ifr))) ; od ; if a = A076936(n-1) then me := me+n ; a := 1 ; for i from 1 to nops(ifr) do a := a*op(1,op(i,ifr))^(me-op(2,op(i,ifr))) ; od ; fi ; RETURN(a) ; fi ; end: A014682 := proc(n) log[2](A076936(n)) ; end: for n from 1 to 85 do printf("%d, ",A014682(n)) ; od ; # R. J. Mathar, Mar 20 2007
  • Mathematica
    Collatz[n_?OddQ] := (3n + 1)/2; Collatz[n_?EvenQ] := n/2; Table[Collatz[n], {n, 0, 79}] (* Alonso del Arte, Apr 21 2011 *)
    LinearRecurrence[{0, 2, 0, -1}, {0, 2, 1, 5}, 70] (* Jean-François Alcover, Sep 23 2017 *)
    Table[If[OddQ[n], (3 n + 1) / 2, n / 2], {n, 0, 60}] (* Vincenzo Librandi, Sep 28 2018 *)
  • PARI
    a(n)=if(n%2,3*n+1,n)/2 \\ Charles R Greathouse IV, Sep 02 2015
    
  • PARI
    a(n)=if(n<2,2*n,(n^2-n-1)%(2*n+1)) \\ Jim Singh, Sep 28 2018
    
  • Python
    def a(n): return n//2 if n%2==0 else (3*n + 1)//2
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jul 29 2017
    

Formula

From Paul Barry, Mar 31 2008: (Start)
G.f.: x*(2 + x + x^2)/(1-x^2)^2.
a(n) = (4*n+1)/4 - (2*n+1)*(-1)^n/4. (End)
a(n) = -a(n-1) + a(n-2) + a(n-3) + 4. - John W. Layman
For n > 1 this is the image of n under the modified "3x+1" map (cf. A006370): n -> n/2 if n is even, n -> (3*n+1)/2 if n is odd. - Benoit Cloitre, May 12 2002
O.g.f.: x*(2+x+x^2)/((-1+x)^2*(1+x)^2). - R. J. Mathar, Apr 05 2008
a(n) = 5/4 + (1/2)*((-1)^n)*n + (3/4)*(-1)^n + n. - Alexander R. Povolotsky, Apr 05 2008
a(n) = Sum_{i=-n..2*n} i*(-1)^i. - Bruno Berselli, Dec 14 2015
a(n) = Sum_{k=0..n-1} Sum_{i=0..k} C(i,k) + (-1)^k. - Wesley Ivan Hurt, Sep 20 2017
a(n) = (n^2-n-1) mod (2*n+1) for n > 1. - Jim Singh, Sep 26 2018
The above formula can be rewritten to show a pattern: a(n) = (n*(n+1)) mod (n+(n+1)). - Peter Munn, Jan 29 2022
Binary: a(n) = (n shift left (n AND 1)) - (n shift right 1) = A109043(n) - A004526(n). - Rudi B. Stranden, Jun 15 2021
From Rudi B. Stranden, Mar 21 2022: (Start)
a(n) = A064455(n+1) - 1, relating the number ON cells in row n of cellular automaton rule 54.
a(n) = 2*n - A071045(n).
(End)
E.g.f.: (1 + x)*sinh(x)/2 + 3*x*cosh(x)/2 = ((4*x+1)*e^x + (2*x-1)*e^(-x))/4. - Rénald Simonetto, Oct 20 2022
a(n) = n*(n mod 2) + ceiling(n/2) = A193356(n) + A008619(n+1). - Jonathan Shadrach Gilbert, Mar 12 2023
a(n) = 2*a(n-2) - a(n-4) for n > 3. - Chai Wah Wu, Apr 17 2024

Extensions

Edited by N. J. A. Sloane, Apr 26 2008, at the suggestion of Artur Jasinski
Edited by N. J. A. Sloane, Jan 31 2011

A052928 The even numbers repeated.

Original entry on oeis.org

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

Views

Author

encyclopedia(AT)pommard.inria.fr, Jan 25 2000

Keywords

Comments

a(n) is also the binary rank of the complete graph K(n). - Alessandro Cosentino (cosenal(AT)gmail.com), Feb 07 2009
Let I=I_n be the n X n identity matrix and P=P_n be the incidence matrix of the cycle (1,2,3,...,n). Then, for n >= 6, a(n) is the number of (0,1) n X n matrices A <= P^(-1)+I+P having exactly two 1's in every row and column with perA=2. - Vladimir Shevelev, Apr 12 2010
a(n+2) is the number of symmetry allowed, linearly independent terms at n-th order in the series expansion of the (E+A)xe vibronic perturbation matrix, H(Q) (cf. Eisfeld & Viel). - Bradley Klee, Jul 21 2015
The arithmetic function v_2(n,1) as defined in A289187. - Robert Price, Aug 22 2017
For n > 1, also the chromatic number of the n X n white bishop graph. - Eric W. Weisstein, Nov 17 2017
For n > 2, also the maximum vertex degree of the n-polygon diagonal intersection graph. - Eric W. Weisstein, Mar 23 2018
For n >= 2, a(n+2) gives the minimum weight of a Boolean function of algebraic degree at most n-2 whose support contains n linearly independent elements. - Christof Beierle, Nov 25 2019

References

  • C. D. Godsil and G. Royle, Algebraic Graph Theory, Springer, 2001, page 181. - Alessandro Cosentino (cosenal(AT)gmail.com), Feb 07 2009
  • V. S. Shevelyov (Shevelev), Extension of the Moser class of four-line Latin rectangles, DAN Ukrainy, 3(1992),15-19.

Crossrefs

First differences: A010673; partial sums: A007590; partial sums of partial sums: A212964(n+1).
Complement of A109613 with respect to universe A004526. - Guenther Schrack, Dec 07 2017
Is first differences of A099392. Fixed point sequence: A005843. - Guenther Schrack, May 30 2019
For n >= 3, A329822(n) gives the minimum weight of a Boolean function of algebraic degree at most n-3 whose support contains n linearly independent elements. - Christof Beierle, Nov 25 2019

Programs

  • Haskell
    a052928 = (* 2) . flip div 2
    a052928_list = 0 : 0 : map (+ 2) a052928_list
    -- Reinhard Zumkeller, Jun 20 2015
  • Magma
    [2*Floor(n/2) : n in [0..50]]; // Wesley Ivan Hurt, Sep 13 2014
    
  • Maple
    spec := [S,{S=Union(Sequence(Prod(Z,Z)),Prod(Sequence(Z),Sequence(Z)))},unlabeled]: seq(combstruct[count](spec,size=n), n=0..20);
  • Mathematica
    Flatten[Table[{2n, 2n}, {n, 0, 39}]] (* Alonso del Arte, Jun 24 2012 *)
    With[{ev=2Range[0,40]},Riffle[ev,ev]] (* Harvey P. Dale, May 08 2021 *)
    Table[Round[n + 1/2], {n, -1, 72}] (* Ed Pegg Jr, Jul 28 2025 *)
  • PARI
    a(n)=n\2*2 \\ Charles R Greathouse IV, Nov 20 2011
    

Formula

a(n) = 2*floor(n/2).
G.f.: 2*x^2/((-1+x)^2*(1+x)).
a(n) + a(n+1) + 2 - 2*n = 0.
a(n) = n - 1/2 + (-1)^n/2.
a(n) = n + Sum_{k=1..n} (-1)^k. - William A. Tedeschi, Mar 20 2008
a(n) = a(n-1) + a(n-2) - a(n-3). - R. J. Mathar, Feb 19 2010
a(n) = |A123684(n) - A064455(n)| = A032766(n) - A008619(n-1). - Jaroslav Krizek, Mar 22 2011
For n > 0, a(n) = floor(sqrt(n^2+(-1)^n)). - Francesco Daddi, Aug 02 2011
a(n) = Sum_{k>=0} A030308(n,k)*b(k) with b(0)=0 and b(k)=2^k for k>0. - Philippe Deléham, Oct 19 2011
a(n) = A109613(n) - 1. - M. F. Hasler, Oct 22 2012
a(n) = n - (n mod 2). - Wesley Ivan Hurt, Jun 29 2013
a(n) = a(a(n-1)) + a(n-a(n-1)) for n>2. - Nathan Fox, Jul 24 2016
a(n) = 2*A004526(n). - Filip Zaludek, Oct 28 2016
E.g.f.: x*exp(x) - sinh(x). - Ilya Gutkovskiy, Oct 28 2016
a(-n) = -a(n+1); a(n) = A005843(A004526(n)). - Guenther Schrack, Sep 11 2018
From Guenther Schrack, May 29 2019: (Start)
a(b(n)) = b(n) + ((-1)^b(n) - 1)/2 for any sequence b(n) of offset 0.
a(a(n)) = a(n), idempotent.
a(A086970(n)) = A124356(n-1) for n > 1.
a(A000124(n)) = A192447(n+1).
a(n)*a(n+1)/2 = A007590(n), also equals partial sums of a(n).
A007590(a(n)) = 2*A008794(n). (End)

Extensions

More terms from James Sellers, Jun 05 2000
Removed duplicate of recurrence; corrected original recurrence and g.f. against offset - R. J. Mathar, Feb 19 2010

A080512 a(n) = n if n is odd, a(n) = 3*n/2 if n is even.

Original entry on oeis.org

1, 3, 3, 6, 5, 9, 7, 12, 9, 15, 11, 18, 13, 21, 15, 24, 17, 27, 19, 30, 21, 33, 23, 36, 25, 39, 27, 42, 29, 45, 31, 48, 33, 51, 35, 54, 37, 57, 39, 60, 41, 63, 43, 66, 45, 69, 47, 72, 49, 75, 51, 78, 53, 81, 55, 84, 57, 87, 59, 90, 61, 93, 63, 96, 65, 99, 67, 102
Offset: 1

Views

Author

Amarnath Murthy, Mar 20 2003

Keywords

Comments

First differences of the generalized heptagonal numbers A085787. - Omar E. Pol, Sep 10 2011
Last term in n-th row of A080511.
Also A005408 and positive terms of A008585 interleaved. - Omar E. Pol, May 28 2012
a(n) is also the length of the n-th line segment of the rectangular spiral whose vertices are the generalized heptagonal numbers. - Omar E. Pol, Jul 27 2018

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    a080512 n = if m == 0 then 3 * n' else n  where (n', m) = divMod n 2
    a080512_list = concat $ transpose [[1, 3 ..], [3, 6 ..]]
    -- Reinhard Zumkeller, Apr 06 2015
  • Magma
    [n*(5+(-1)^n)/4: n in [1..60]]; // Vincenzo Librandi, Sep 11 2011
    
  • Mathematica
    Table[If[EvenQ[n],3n/2,n],{n,68}] (* Jayanta Basu, May 20 2013 *)

Formula

a(n) = n if n is odd, a(n) = 3*n/2 if n is even.
a(n)*a(n+3) = -3 + a(n+1)*a(n+2).
From Paul Barry, Sep 04 2003: (Start)
G.f.: (1+3*x+x^2)/((1-x^2)^2);
a(n) = n*(5 + (-1)^n)/4. (End)
Multiplicative with a(2^e) = 3*2^(e-1), a(p^e) = p^e otherwise. - Christian G. Bower, May 17 2005
Equals A126988 * (1, 1, 0, 0, 0, ...) - Gary W. Adamson, Apr 17 2007
Dirichlet g.f.: zeta(s-1) * (1 + 1/2^s). - Amiram Eldar, Oct 25 2023
Sum_{d divides n} mu(n/d)*a(d) = A126246(n), where mu(n) = A008683(n) is the Möbius function. - Peter Bala, Dec 31 2023

A123684 Alternate A016777(n) with A000027(n).

Original entry on oeis.org

1, 1, 4, 2, 7, 3, 10, 4, 13, 5, 16, 6, 19, 7, 22, 8, 25, 9, 28, 10, 31, 11, 34, 12, 37, 13, 40, 14, 43, 15, 46, 16, 49, 17, 52, 18, 55, 19, 58, 20, 61, 21, 64, 22, 67, 23, 70, 24, 73, 25, 76, 26, 79, 27, 82, 28, 85, 29, 88, 30, 91, 31, 94, 32, 97, 33, 100, 34, 103, 35, 106, 36
Offset: 1

Views

Author

Alford Arnold, Oct 11 2006

Keywords

Comments

a(n) is a diagonal of Table A123685.
The arithmetic average of the first n terms gives the positive integers repeated (A008619). - Philippe Deléham, Nov 20 2013
Images under the modified '3x-1' map: a(n) = n/2 if n is even, (3n-1)/2 if n is odd. (In this sequence, the numbers at even indices n are n/2 [A000027], and the numbers at odd indices n are 3((n-1)/2) + 1 [A016777] = (3n-1)/2.) The latter correspondence interestingly mirrors an insight in David Bařina's 2020 paper (see below), namely that 3(n+1)/2 - 1 = (3n+1)/2. - Kevin Ge, Oct 30 2024

Examples

			The natural numbers begin 1, 2, 3, ... (A000027), the sequence 3*n + 1 begins 1, 4, 7, 10, ... (A016777), therefore A123684 begins 1, 1, 4, 2, 7, 3, 10, ...
1/1 = 1, (1+1)/2 = 1, (1+1+4)/3 = 2, (1+1+4+2)/4 = 2, ... - _Philippe Deléham_, Nov 20 2013
		

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    a123684 n = a123684_list !! (n-1)
    a123684_list = concat $ transpose [a016777_list, a000027_list]
    -- Reinhard Zumkeller, Apr 29 2013
    
  • Magma
    &cat[ [ 3*n-2, n ]: n in [1..36] ]; // Klaus Brockhaus, May 12 2007
    
  • Magma
    /* From the fourteenth formula: */ [&+[1+k*(-1)^k: k in [0..n]]: n in [0..80]]; // Bruno Berselli, Jul 16 2013
    
  • Maple
    A123684:=n->n-1/4-(1/2*n-1/4)*(-1)^n: seq(A123684(n), n=1..70); # Wesley Ivan Hurt, Jul 26 2014
  • Mathematica
    CoefficientList[Series[(1 +x +2*x^2)/((1-x)^2*(1+x)^2), {x,0,70}], x] (* Wesley Ivan Hurt, Jul 26 2014 *)
    LinearRecurrence[{0,2,0,-1},{1,1,4,2},80] (* Harvey P. Dale, Apr 14 2025 *)
  • PARI
    print(vector(72, n, if(n%2==0, n/2, (3*n-1)/2))) \\ Klaus Brockhaus, May 12 2007
    
  • PARI
    print(vector(72, n, n-1/4-(1/2*n-1/4)*(-1)^n)); \\ Klaus Brockhaus, May 12 2007
    
  • SageMath
    [(n + (2*n-1)*(n%2))//2 for n in range(1,71)] # G. C. Greubel, Mar 15 2024

Formula

From Klaus Brockhaus, May 12 2007: (Start)
G.f.: x*(1+x+2*x^2)/((1-x)^2*(1+x)^2).
a(n) = (1/4)*(4*n - 1 - (2*n - 1)*(-1)^n).
a(2n-1) = A016777(n-1) = 3(n-1) + 1.
a(2n) = A000027(n) = n.
a(n) = A071045(n-1) + 1.
a(n) = A093005(n) - A093005(n-1) for n > 1.
a(n) = A105638(n+2) - A105638(n+1) for n > 1.
a(n) = A092530(n) - A092530(n-1) - 1.
a(n) = A031878(n+1) - A031878(n) - 1. (End)
a(2*n+1) + a(2*n+2) = A016825(n). - Paul Curtz, Mar 09 2011
a(n)= 2*a(n-2) - a(n-4). - Paul Curtz, Mar 09 2011
From Jaroslav Krizek, Mar 22 2011 (Start):
a(n) = n + a(n-1) for odd n; a(n) = n - A064455(n-1) for even n.
a(n) = A064455(n) - A137501(n).
Abs(a(n) - A064455(n)) = A052928(n). (End)
a(n) = A225126(n) for n > 1. - Reinhard Zumkeller, Apr 29 2013
a(n) = Sum_{k=1..n} (1 + (k-1)*(-1)^(k-1)). - Bruno Berselli, Jul 16 2013
a(n) = n + floor(n/2) for odd n; a(n) = n/2 for even n. - Reinhard Muehlfeld, Jul 25 2014

Extensions

More terms from Klaus Brockhaus, May 12 2007

A265667 Permutation of nonnegative integers: a(n) = n + floor(n/3)*(-1)^(n mod 3).

Original entry on oeis.org

0, 1, 2, 4, 3, 6, 8, 5, 10, 12, 7, 14, 16, 9, 18, 20, 11, 22, 24, 13, 26, 28, 15, 30, 32, 17, 34, 36, 19, 38, 40, 21, 42, 44, 23, 46, 48, 25, 50, 52, 27, 54, 56, 29, 58, 60, 31, 62, 64, 33, 66, 68, 35, 70, 72, 37, 74, 76, 39, 78, 80, 41, 82, 84, 43, 86, 88, 45
Offset: 0

Views

Author

Bruno Berselli, Dec 12 2015 - based on an idea by Paul Curtz

Keywords

Comments

The inverse permutation is given by P(n) = A006368(n-1) + 1, for n >= 1, and P(0) = 0. - Wolfdieter Lang, Sep 21 2021
This permutation is given by A006369(n-1) + 1, with A006369(-1) = -1. Observed by Kevin Ryde. - Wolfdieter Lang, Sep 22 2021

Examples

			-------------------------------------------------------------------------
0, 1, 2, 3,  4, 5, 6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17, 18, ...
+  +  +  +   +  +  +   +   +   +   +   +   +   +   +   +   +   +   +
0, 0, 0, 1, -1, 1, 2, -2,  2,  3, -3,  3,  4, -4,  4,  5, -5,  5,  6, ...
-------------------------------------------------------------------------
0, 1, 2, 4,  3, 6, 8,  5, 10, 12,  7, 14, 16,  9, 18, 20, 11, 22, 24, ...
-------------------------------------------------------------------------
		

Crossrefs

Cf. A064455: n+floor(n/2)*(-1)^(n mod 2).
Cf. A265888: n+floor(n/4)*(-1)^(n mod 4).
Cf. A265734: n+floor(n/5)*(-1)^(n mod 5).

Programs

  • Magma
    [n+Floor(n/3)*(-1)^(n mod 3): n in [0..70]];
  • Mathematica
    Table[n + Floor[n/3] (-1)^Mod[n, 3], {n, 0, 70}]
  • Sage
    [n+floor(n/3)*(-1)^mod(n,3) for n in (0..70)]
    

Formula

G.f.: x*(1 + 2*x + 4*x^2 + x^3 + 2*x^4) / ((1 - x)^2*(1 + x + x^2)^2).
a(n) = 2*a(n-3) - a(n-6).
a(3*k) = 4*k;
a(3*k+1) = 2*k+1, hence a(3*k+1) = a(3*k)/2 + 1;
a(3*k+2) = 4*k+2, hence a(3*k+2) = 2*a(3*k+1) = a(3*k) + 2.
Sum_{i=0..n} a(i) = A008738(A032793(n+1)).
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/8 + log(2)/4. - Amiram Eldar, Mar 30 2023

A071030 Triangle read by rows giving successive states of cellular automaton generated by "Rule 54".

Original entry on oeis.org

1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1
Offset: 0

Views

Author

Hans Havermann, May 26 2002

Keywords

Comments

Row n has length 2n+1.
Even rows r sum to r/2 + 1, odd rows r sum to 3r to produce the sequence {1, 3, 2, 6, 3, 9, 4, 12, ...} = A064455(n + 1). - Michael De Vlieger, Oct 07 2015

Examples

			From _Michael De Vlieger_, Oct 07 2015: (Start)
First 12 rows, replacing "0" with "." for better visibility of ON cells:
                        1
                      1 1 1
                    1 . . . 1
                  1 1 1 . 1 1 1
                1 . . . 1 . . . 1
              1 1 1 . 1 1 1 . 1 1 1
            1 . . . 1 . . . 1 . . . 1
          1 1 1 . 1 1 1 . 1 1 1 . 1 1 1
        1 . . . 1 . . . 1 . . . 1 . . . 1
      1 1 1 . 1 1 1 . 1 1 1 . 1 1 1 . 1 1 1
    1 . . . 1 . . . 1 . . . 1 . . . 1 . . . 1
  1 1 1 . 1 1 1 . 1 1 1 . 1 1 1 . 1 1 1 . 1 1 1
1 . . . 1 . . . 1 . . . 1 . . . 1 . . . 1 . . . 1
(End)
		

References

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

Crossrefs

Cf. A064455. See A118108 and A118109 for two other versions of this sequence.

Programs

  • Mathematica
    clip[lst_] := Block[{p = Flatten@ Position[lst, 1]}, Take[lst, {Min@ p, Max@ p}]]; clip /@ CellularAutomaton[54, {{1}, 0}, 8] // Flatten (* Michael De Vlieger, Oct 07 2015 *)

Extensions

Corrected by Hans Havermann, Jan 07 2012

A137501 The even numbers repeated, with alternating signs.

Original entry on oeis.org

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

Views

Author

Carlos Alberto da Costa Filho (cacau_dacosta(AT)hotmail.com), Apr 22 2008

Keywords

Comments

The general formula for alternating sums of powers of even integers is in terms of the Swiss-Knife polynomials P(n,x) A153641 (P(n,1)-(-1)^k P(n,2k+1))/2. Here n=1 and k shifted one place, thus a(k) = (P(1,1)-(-1)^(k-1) P(1,2(k-1)+1))/2. - Peter Luschny, Jul 12 2009
With just one 0 at the beginning, this is a permutation of all the even integers. - Alonso del Arte, Jun 24 2012

Crossrefs

Programs

  • Maple
    den:= n -> (n-1/2+1/2*(-1)^n)*(-1)^n: seq(den(n),n=-10..10);
    a := n -> (1+(-1)^n*(2*n-1))/2; # Peter Luschny, Jul 12 2009
  • Mathematica
    Flatten[Table[{2n, -2n}, {n, 0, 39}]] (* Alonso del Arte, Jun 24 2012 *)
    With[{enos=2*Range[0,40]},Riffle[enos,-enos]] (* Harvey P. Dale, Oct 12 2014 *)

Formula

a(n) = ( n - (1/2) + (1/2)*(-1)^n )*(-1)^n.
From R. J. Mathar, Feb 14 2010: (Start)
a(n) = -a(n-1) + a(n-2) + a(n-3).
G.f.: 2*x^2/((1-x) * (1+x)^2). (End)
a(n) = A064455(n) - A123684(n). - Jaroslav Krizek, Mar 22 2011

A098557 Expansion of e.g.f. (1/2)*(1+x)*log((1+x)/(1-x)).

Original entry on oeis.org

0, 1, 2, 2, 8, 24, 144, 720, 5760, 40320, 403200, 3628800, 43545600, 479001600, 6706022400, 87178291200, 1394852659200, 20922789888000, 376610217984000, 6402373705728000, 128047474114560000, 2432902008176640000, 53523844179886080000, 1124000727777607680000
Offset: 0

Views

Author

Paul Barry, Sep 14 2004

Keywords

Crossrefs

From Johannes W. Meijer, Nov 12 2009: (Start)
Cf. A109613 (odd numbers repeated).
Equals the first left hand column of A167552.
Equals the first right hand column of A167556.
A098557(n)*A064455(n) equals the second right hand column of A167556(n).
(End)

Programs

  • Magma
    [0,1] cat [Factorial(n-1) + Factorial(n-2)*(1+(-1)^n)/2: n in [2..30]]; // G. C. Greubel, Jan 17 2018
  • Mathematica
    Join[{0,1}, Table[(n-1)! + (n-2)!*(1+(-1)^n)/2, {n,2,30}]] (* or *) With[{nmax = 50}, CoefficientList[Series[(1/2)*(1 + x)*Log[(1 + x)/(1 - x)], {x,0,nmax}], x]*Range[0,nmax]!] (* G. C. Greubel, Jan 17 2018 *)
  • PARI
    for(n=0, 30, print1(if(n==0,0, if(n==1, 1, (n-1)! + (n-2)!*(1 + (-1)^n)/2)), ", ")) \\ G. C. Greubel, Jan 17 2018
    

Formula

a(n+1) = n! + (n-1)! * (1-(-1)^n)/2.
a(n+2) = 2*A052558(n).
conjecture: -a(n) +a(n-1) +(n-1)*(n-3)*a(n-2)=0. - R. J. Mathar, Nov 14 2011
G.f.: 1-G(0), where G(k)= 1 + x*(2*k-1)/(1 - x*(2*k+2)/(x*(2*k+2) + 1/G(k+1))); (continued fraction). - Sergei N. Gladkovskii, Jun 11 2013
Sum_{n>=1} 1/a(n) = sinh(1) + 1 = A073742 + 1. - Amiram Eldar, Jan 22 2023

A265734 Permutation of nonnegative integers: a(n) = n + floor(n/5)*(-1)^(n mod 5).

Original entry on oeis.org

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

Views

Author

Bruno Berselli, Dec 15 2015 - based on an idea by Paul Curtz

Keywords

Examples

			------------------------------------------------------------------------
0, 1, 2, 3, 4, 5,  6, 7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17, 18, ...
+  +  +  +  +  +   +  +   +   +   +   +   +   +   +   +   +   +   +
0, 0, 0, 0, 0, 1, -1, 1, -1,  1,  2, -2,  2, -2,  2,  3, -3,  3, -3, ...
------------------------------------------------------------------------
0, 1, 2, 3, 4, 6,  5, 8,  7, 10, 12,  9, 14, 11, 16, 18, 13, 20, 15, ...
------------------------------------------------------------------------
		

Crossrefs

Cf. A001477.
Cf. A064455: n+floor(n/2)*(-1)^(n mod 2).
Cf. A265667: n+floor(n/3)*(-1)^(n mod 3).
Cf. A265888: n+floor(n/4)*(-1)^(n mod 4)

Programs

  • Magma
    [n+Floor(n/5)*(-1)^(n mod 5): n in [0..80]];
  • Mathematica
    Table[n + Floor[n/5] (-1)^Mod[n, 5], {n, 0, 80}]
  • Sage
    [n+floor(n/5)*(-1)^mod(n, 5) for n in (0..80)]
    

Formula

G.f.: x*(1 + 2*x + 3*x^2 + 4*x^3 + 6*x^4 + 3*x^5 + 4*x^6 + x^7 + 2*x^8) / ((1 - x)^2*(1 + x + x^2 + x^3 + x^4)^2).
a(n) = 2*a(n-5) - a(n-10).
a(5*k+r) = (5+(-1)^r)*k + r, where r=0..4.
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi*(1/(2*sqrt(2))-1/(3*sqrt(3))) + log(2)/6. - Amiram Eldar, Mar 30 2023
Showing 1-10 of 22 results. Next