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

A114113 a(n) = sum{k=1 to n} (A114112(k)). (For n>=2, a(n) = sum{k=1 to n} (A014681(k)) =sum{k=1 to n} (A103889(k)).).

Original entry on oeis.org

1, 3, 7, 10, 16, 21, 29, 36, 46, 55, 67, 78, 92, 105, 121, 136, 154, 171, 191, 210, 232, 253, 277, 300, 326, 351, 379, 406, 436, 465, 497, 528, 562, 595, 631, 666, 704, 741, 781, 820, 862, 903, 947, 990, 1036, 1081, 1129, 1176, 1226, 1275, 1327, 1378, 1432
Offset: 1

Views

Author

Leroy Quet, Nov 13 2005

Keywords

Comments

a(n) is not divisible by (A114112(n+1)).
Sequence is A130883 union A014105 - {0,2}. - Anthony Hernandez, Sep 08 2016

Crossrefs

Programs

  • Magma
    I:=[1,3,7,10,16]; [n le 5 select I[n] else 2*Self(n-1)-2*Self(n-3)+Self(n-4): n in [1..60]]; // Vincenzo Librandi, Mar 13 2018
    
  • Mathematica
    Join[{1}, LinearRecurrence[{2, 0, -2, 1}, {3, 7, 10, 16}, 52]] (* Jean-François Alcover, Sep 22 2017 *)
    CoefficientList[Series[(1 + x + x^2 -2 x^3 + x^4)/((1 + x) (1 - x)^3), {x, 0, 60}], x] (* Vincenzo Librandi, Mar 13 2018 *)
  • Python
    def A114113(n): return 1 if n == 1 else (m:=n//2)*(n+1) + (n+1-m)*(n-2*m) # Chai Wah Wu, May 24 2022

Formula

a(1)=1. a(2n) = n*(2n+1). a(2n+1) = 2n^2 +3n +2.
From R. J. Mathar, Nov 04 2008: (Start)
a(n) = A026035(n+1) - A026035(n), n>1.
G.f.: x(1+x+x^2-2x^3+x^4)/((1+x)(1-x)^3).
a(n) = 2*a(n-1)-2*a(n-3)+a(n-4), n>5. (End)
This is (essentially) 1 + A084265, - N. J. A. Sloane, Mar 12 2018

Extensions

More terms from R. J. Mathar, Aug 31 2007

A289805 p-INVERT of A103889, where p(S) = 1 - S - S^2.

Original entry on oeis.org

2, 9, 36, 153, 624, 2584, 10632, 43865, 180774, 745347, 3072528, 12666854, 52218790, 215273737, 887468000, 3658604277, 15082652352, 62178493132, 256331858332, 1056732372729, 4356396740786, 17959318086575, 74037587378784, 305221185520298, 1258279413185322
Offset: 0

Views

Author

Clark Kimberling, Aug 12 2017

Keywords

Comments

Suppose s = (c(0), c(1), c(2), ...) is a sequence and p(S) is a polynomial. Let S(x) = c(0)*x + c(1)*x^2 + c(2)*x^3 + ... and T(x) = (-p(0) + 1/p(S(x)))/x. The p-INVERT of s is the sequence t(s) of coefficients in the Maclaurin series for T(x). Taking p(S) = 1 - S gives the INVERT transform of s, so that p-INVERT is a generalization of the INVERT transform (e.g., A033453).
See A289780 for a guide to related sequences.

Crossrefs

Programs

  • Mathematica
    z = 60; s = x*(x^2 - x + 2)/((x - 1)^2*(1 + x)); p = 1 - s - s^2;
    Drop[CoefficientList[Series[s, {x, 0, z}], x], 1] (* A103889 *)
    Drop[CoefficientList[Series[1/p, {x, 0, z}], x], 1] (* A289805 *)
    LinearRecurrence[{4,2,-8,8,-2,1},{2,9,36,153,624,2584},30] (* Harvey P. Dale, Jun 30 2021 *)

Formula

G.f.: (-2 - x + 4 x^2 - 7 x^3 + 4 x^4 - 2 x^5)/(-1 + 4 x + 2 x^2 - 8 x^3 + 8 x^4 - 2 x^5 + x^6).
a(n) = 4*a(n-1) + 2*a(n-2) - 8*a(n-3) + 8*a(n-4) - 2*a(n-5) + a(n-6).

A203196 (n-1)-st elementary symmetric function of the first n terms of (2,1,4,3,6,5,8,7,...)=A103889.

Original entry on oeis.org

1, 3, 14, 50, 324, 1764, 14832, 109584, 1136160, 10628640, 131172480, 1486442880, 21289201920, 283465647360, 4622628648960, 70734282393600, 1294139872972800, 22376988058521600, 453942134876160000, 8752948036761600000
Offset: 1

Views

Author

Clark Kimberling, Dec 30 2011

Keywords

Comments

a(2n)=A000254(2n) for n=1,2,3...

Crossrefs

Cf. A103889.

Programs

  • Mathematica
    f[k_] := If[Mod[k, 2] == 0, k - 1, k + 1]
    t[n_] := Table[f[k], {k, 1, n}]
    a[n_] := SymmetricPolynomial[n - 1, t[n]]
    Table[a[n], {n, 1, 14}]  (* A203196 *)

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

A289780 p-INVERT of the positive integers (A000027), where p(S) = 1 - S - S^2.

Original entry on oeis.org

1, 4, 14, 47, 156, 517, 1714, 5684, 18851, 62520, 207349, 687676, 2280686, 7563923, 25085844, 83197513, 275925586, 915110636, 3034975799, 10065534960, 33382471801, 110713382644, 367182309614, 1217764693607, 4038731742156, 13394504020957, 44423039068114
Offset: 0

Views

Author

Clark Kimberling, Aug 10 2017

Keywords

Comments

Suppose s = (c(0), c(1), c(2), ...) is a sequence and p(S) is a polynomial. Let S(x) = c(0)*x + c(1)*x^2 + c(2)*x^3 + ... and T(x) = (-p(0) + 1/p(S(x)))/x. The p-INVERT of s is the sequence t(s) of coefficients in the Maclaurin series for T(x).
Taking p(S) = 1 - S gives the INVERT transform of s, so that p-INVERT is a generalization of the INVERT transform (e.g., A033453).
Guide to p-INVERT sequences using p(S) = 1 - S - S^2:
t(A000012) = t(1,1,1,1,1,1,1,...) = A001906
t(A000290) = t(1,4,9,16,25,36,...) = A289779
t(A000027) = t(1,2,3,4,5,6,7,8,...) = A289780
t(A000045) = t(1,2,3,5,8,13,21,...) = A289781
t(A000032) = t(2,1,3,4,7,11,14,...) = A289782
t(A000244) = t(1,3,9,27,81,243,...) = A289783
t(A000302) = t(1,4,16,64,256,...) = A289784
t(A000351) = t(1,5,25,125,625,...) = A289785
t(A005408) = t(1,3,5,7,9,11,13,...) = A289786
t(A005843) = t(2,4,6,8,10,12,14,...) = A289787
t(A016777) = t(1,4,7,10,13,16,...) = A289789
t(A016789) = t(2,5,8,11,14,17,...) = A289790
t(A008585) = t(3,6,9,12,15,18,...) = A289795
t(A000217) = t(1,3,6,10,15,21,...) = A289797
t(A000225) = t(1,3,7,15,31,63,...) = A289798
t(A000578) = t(1,8,27,64,625,...) = A289799
t(A000984) = t(1,2,6,20,70,252,...) = A289800
t(A000292) = t(1,4,10,20,35,56,...) = A289801
t(A002620) = t(1,2,4,6,9,12,16,...) = A289802
t(A001906) = t(1,3,8,21,55,144,...) = A289803
t(A001519) = t(1,1,2,5,13,34,...) = A289804
t(A103889) = t(2,1,4,3,6,5,8,7,,...) = A289805
t(A008619) = t(1,1,2,2,3,3,4,4,...) = A289806
t(A080513) = t(1,2,2,3,3,4,4,5,...) = A289807
t(A133622) = t(1,2,1,3,1,4,1,5,...) = A289809
t(A000108) = t(1,1,2,5,14,42,...) = A081696
t(A081696) = t(1,1,3,9,29,97,...) = A289810
t(A027656) = t(1,0,2,0,3,0,4,0,5...) = A289843
t(A175676) = t(1,0,0,2,0,0,3,0,...) = A289844
t(A079977) = t(1,0,1,0,2,0,3,...) = A289845
t(A059841) = t(1,0,1,0,1,0,1,...) = A289846
t(A000040) = t(2,3,5,7,11,13,...) = A289847
t(A008578) = t(1,2,3,5,7,11,13,...) = A289828
t(A000142) = t(1!, 2!, 3!, 4!, ...) = A289924
t(A000201) = t(1,3,4,6,8,9,11,...) = A289925
t(A001950) = t(2,5,7,10,13,15,...) = A289926
t(A014217) = t(1,2,4,6,11,17,29,...) = A289927
t(A000045*) = t(0,1,1,2,3,5,...) = A289975 (* indicates prepended 0's)
t(A000045*) = t(0,0,1,1,2,3,5,...) = A289976
t(A000045*) = t(0,0,0,1,1,2,3,5,...) = A289977
t(A290990*) = t(0,1,2,3,4,5,...) = A290990
t(A290990*) = t(0,0,1,2,3,4,5,...) = A290991
t(A290990*) = t(0,0,01,2,3,4,5,...) = A290992

Examples

			Example 1:  s = (1,2,3,4,5,6,...) = A000027 and p(S) = 1 - S.
S(x) = x + 2x^2 + 3x^3 + 4x^4 + ...
p(S(x)) = 1 - (x + 2x^2 + 3x^3 + 4x^4 + ... )
- p(0) + 1/p(S(x)) = -1 + 1 + x + 3x^2 + 8x^3 + 21x^4 + ...
T(x) = 1 + 3x + 8x^2 + 21x^3 + ...
t(s) = (1,3,8,21,...) = A001906.
***
Example 2:  s = (1,2,3,4,5,6,...) = A000027 and p(S) = 1 - S - S^2.
S(x) =  x + 2x^2 + 3x^3 + 4x^4 + ...
p(S(x)) = 1 - ( x + 2x^2 + 3x^3 + 4x^4 + ...) - ( x + 2x^2 + 3x^3 + 4x^4 + ...)^2
- p(0) + 1/p(S(x)) = -1 + 1 + x + 4x^2 + 14x^3 + 47x^4 + ...
T(x) = 1 + 4x + 14x^2 + 47x^3 + ...
t(s) = (1,4,14,47,...) = A289780.
		

Crossrefs

Cf. A000027.

Programs

  • GAP
    P:=[1,4,14,47];; for n in [5..10^2] do P[n]:=5*P[n-1]-7*P[n-2]+5*P[n-3]-P[n-4]; od; P; # Muniru A Asiru, Sep 03 2017
  • Mathematica
    z = 60; s = x/(1 - x)^2; p = 1 - s - s^2;
    Drop[CoefficientList[Series[s, {x, 0, z}], x], 1] (* A000027 *)
    Drop[CoefficientList[Series[1/p, {x, 0, z}], x], 1] (* A289780 *)
  • PARI
    x='x+O('x^99); Vec((1-x+x^2)/(1-5*x+7*x^2-5*x^3+x^4)) \\ Altug Alkan, Aug 13 2017
    

Formula

G.f.: (1 - x + x^2)/(1 - 5 x + 7 x^2 - 5 x^3 + x^4).
a(n) = 5*a(n-1) - 7*a(n-2) + 5*a(n-3) - a(n-4).

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

A339399 Pairwise listing of the partitions of k into two parts (s,t), with 0 < s <= t ordered by increasing values of s and where k = 2,3,... .

Original entry on oeis.org

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

Views

Author

Wesley Ivan Hurt, Dec 02 2020

Keywords

Comments

a(n-1) and a(n) are the lesser and greater of a twin prime pair if and only if a(n) = a(n-1) + 2 where a(n-1) and a(n) are prime.

Examples

			                                                                     [1,9]
                                                     [1,7]   [1,8]   [2,8]
                                     [1,5]   [1,6]   [2,6]   [2,7]   [3,7]
                     [1,3]   [1,4]   [2,4]   [2,5]   [3,5]   [3,6]   [4,6]
     [1,1]   [1,2]   [2,2]   [2,3]   [3,3]   [3,4]   [4,4]   [4,5]   [5,5]
   k   2       3       4       5       6       7       8       9      10
  --------------------------------------------------------------------------
   k   Nondecreasing partitions of k
  --------------------------------------------------------------------------
   2   1,1
   3   1,2
   4   1,3,2,2
   5   1,4,2,3
   6   1,5,2,4,3,3
   7   1,6,2,5,3,4
   8   1,7,2,6,3,5,4,4
   9   1,8,2,7,3,6,4,5
  10   1,9,2,8,3,7,4,6,5,5
  ...
		

Crossrefs

Bisections: A122197 (odd), A199474 (even).

Programs

  • Mathematica
    t[n_] := Flatten[Reverse /@ IntegerPartitions[n, {2}]]; Array[t, 14, 2] // Flatten (* Amiram Eldar, Dec 03 2020 *)
    Table[(1 + (-1)^n) (1 + Floor[Sqrt[2 n - 1 - (-1)^n]])/2 - ((2 n + 1 - (-1)^n)/2 - 2 Sum[Floor[(k + 1)/2], {k, -1 + Floor[Sqrt[2 n - 2 - (-1)^n]]}]) (-1)^n/2, {n, 100}] (* Wesley Ivan Hurt, Dec 04 2020 *)
  • PARI
    row(n) = vector(n\2, i, [i, n-i]);
    tabf(nn) = for (n=2, nn, print(row(n))); \\ Michel Marcus, Dec 03 2020

Formula

a(n) = (1+(-1)^n)*(1+floor(sqrt(2*n-1-(-1)^n)))/2-((2*n+1-(-1)^n)/2-2 *Sum_{k=1..floor(sqrt(2*n-2-(-1)^n)-1)} floor((k+1)/2))*(-1)^n/2.
a(n) = A339443(A103889(n)). - Wesley Ivan Hurt, May 09 2021

A114285 Expansion of g.f. (1 - 3*x)/((1 - x)*(1 - x^2)).

Original entry on oeis.org

1, -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
Offset: 0

Views

Author

Paul Barry, Nov 20 2005

Keywords

Comments

Diagonal sums of A114284.

Crossrefs

Programs

Formula

a(n) = Sum_{k=0..floor(n/2)} 3*0^(n-2k) - 2.
a(n) = 3*(1 + (-1)^n)/2 - 2*floor((n+2)/2).
a(n) = - A103889(n). - R. J. Mathar, Apr 06 2008
From Wesley Ivan Hurt, Sep 06 2015: (Start)
a(n) = a(n-1) + a(n-2) - a(n-3), n > 2.
a(n) = (-1)^n - n. (End)
E.g.f.: exp(-x) - x*exp(x). - Stefano Spezia, May 03 2023

A359855 Array read by antidiagonals: T(n,k) is the number of Hamiltonian cycles in the stacked prism graph P_n X C_k, n >= 1, k >= 2.

Original entry on oeis.org

1, 1, 4, 1, 3, 4, 1, 6, 6, 4, 1, 5, 22, 12, 4, 1, 8, 30, 82, 24, 4, 1, 7, 86, 160, 306, 48, 4, 1, 10, 126, 776, 850, 1142, 96, 4, 1, 9, 318, 1484, 7010, 4520, 4262, 192, 4, 1, 12, 510, 6114, 18452, 63674, 24040, 15906, 384, 4, 1, 11, 1182, 12348, 126426, 229698, 578090, 127860, 59362, 768, 4
Offset: 1

Views

Author

Andrew Howroyd, Feb 18 2025

Keywords

Comments

The case for P_n X C_2 is determined using a double edge for C_2.

Examples

			Array begins:
=========================================================
n\k | 2   3     4      5       6        7          8 ...
----+---------------------------------------------------
  1 | 1   1     1      1       1        1          1 ...
  2 | 4   3     6      5       8        7         10 ...
  3 | 4   6    22     30      86      126        318 ...
  4 | 4  12    82    160     776     1484       6114 ...
  5 | 4  24   306    850    7010    18452     126426 ...
  6 | 4  48  1142   4520   63674   229698    2588218 ...
  7 | 4  96  4262  24040  578090  2861964   53055038 ...
  8 | 4 192 15906 127860 5247824 35663964 1087362018 ...
   ...
		

Crossrefs

Rows 1..2 are A000012, A103889(n+1).
Cf. A222196 (order of recurrences), A222197 (main diagonal), A270273, A321172.

A114112 a(1)=1, a(2)=2; thereafter a(n) = n+1 if n odd, n-1 if n even.

Original entry on oeis.org

1, 2, 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

Leroy Quet, Nov 13 2005

Keywords

Comments

a(1)=1; for n>1, a(n) is the smallest positive integer not occurring earlier in the sequence such that a(n) does not divide Sum_{k=1..n-1} a(k). - Leroy Quet, Nov 13 2005 (This was the original definition. A simple induction argument shows that this is the same as the present definition. - N. J. A. Sloane, Mar 12 2018)
Define b(1)=2; for n>1, b(n) is the smallest number not yet in the sequence which shares a prime factor with the sum of all preceding terms. Then a simple induction argument shows that the b(n) sequence is the same as the present sequence with the first term omitted. - David James Sycamore, Feb 26 2018
Here are the details of the two induction arguments (Start)
For a(n), let A(n) = a(1)+...+a(n). The claim is that for n>2 a(n)=n+1 if n odd, n-1 if n even.
The induction hypotheses are: for i
For b(n), the argument is very similar, except that the missing numbers when looking for b(n) are slightly different, and (setting B(n) = b(1)+...b(n)), we have B(2i)=(i+1)(2i+1), B(2i+1)=(i+2)(2i+1). - N. J. A. Sloane, Mar 14 2018
When sequence a(n) is increasing, then the Cesàro means sequence c(n) = (a(1)+...+a(n))/n is also increasing, but the converse is false. This sequence is a such an example where c(n) is increasing, while a(n) is not increasing (Arnaudiès et al.). See proof in A354008. - Bernard Schott, May 11 2022

References

  • J. M. Arnaudiès, P. Delezoide et H. Fraysse, Exercices résolus d'Analyse du cours de mathématiques - 2, Dunod, Exercice 10, pp. 14-16.

Crossrefs

All of A014681, A103889, A113981, A114112, A114285 are essentially the same sequence. - N. J. A. Sloane, Mar 12 2018
Cf. A114113 (partial sums).
See A084265 for the partial sums of the b(n) sequence.
About Cesàro mean theorem: A033999, A141310, A237420, A354008.
Cf. A244009.

Programs

  • Mathematica
    a[1] = 1; a[n_] := a[n] = Block[{k = 1, s, t = Table[ a[i], {i, n - 1}]}, s = Plus @@ t; While[ Position[t, k] != {} || Mod[s, k] == 0, k++ ]; k]; Array[a, 72] (* Robert G. Wilson v, Nov 18 2005 *)
  • PARI
    a(n) = if (n<=2, n, if (n%2, n+1, n-1)); \\ Michel Marcus, May 16 2022
    
  • Python
    def A114112(n): return n + (0 if n <= 2 else -1+2*(n%2)) # Chai Wah Wu, May 24 2022

Formula

G.f.: x*(x^4-2*x^3+x^2+x+1)/((1-x)*(1-x^2)). - N. J. A. Sloane, Mar 12 2018
The g.f. for the b(n) sequence is x*(x^3-3*x^2+2*x+2)/((1-x)*(1-x^2)). - Conjectured (correctly) by Colin Barker, Mar 04 2018
E.g.f.: 1 - x + x^2/2 + (x - 1)*cosh(x) + (x + 1)*sinh(x). - Stefano Spezia, Sep 02 2022
Sum_{n>=1} (-1)^(n+1)/a(n) = 1 - log(2) (A244009). - Amiram Eldar, Jun 29 2025

Extensions

More terms from Robert G. Wilson v, Nov 18 2005
Entry edited (with simpler definition) by N. J. A. Sloane, Mar 12 2018
Showing 1-10 of 32 results. Next