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-3 of 3 results.

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

A141310 The odd numbers interlaced with the constant-2 sequence.

Original entry on oeis.org

1, 2, 3, 2, 5, 2, 7, 2, 9, 2, 11, 2, 13, 2, 15, 2, 17, 2, 19, 2, 21, 2, 23, 2, 25, 2, 27, 2, 29, 2, 31, 2, 33, 2, 35, 2, 37, 2, 39, 2, 41, 2, 43, 2, 45, 2, 47, 2, 49, 2, 51, 2, 53, 2, 55, 2, 57, 2, 59, 2, 61, 2, 63, 2, 65, 2, 67, 2, 69, 2, 71, 2, 73, 2, 75, 2, 77, 2, 79, 2, 81, 2, 83, 2, 85, 2, 87, 2, 89, 2, 91, 2, 93, 2, 95, 2, 97
Offset: 0

Author

Paul Curtz, Aug 02 2008

Keywords

Comments

Similarly, the principle of interlacing a sequence and its first differences leads from A000012 and its differences A000004 to A059841, or from A140811 and its first differences A017593 to a sequence -1, 6, 5, 18, ...
If n is even then a(n) = n + 1 ; otherwise a(n) = 2. - Wesley Ivan Hurt, Jun 05 2013
Denominators of floor((n+1)/2) / (n+1), n > 0. - Wesley Ivan Hurt, Jun 14 2013
a(n) is also the number of minimum total dominating sets in the (n+1)-gear graph for n>1. - Eric W. Weisstein, Apr 11 2018
a(n) is also the number of minimum total dominating sets in the (n+1)-sun graph for n>1. - Eric W. Weisstein, Sep 09 2021
Denominators of Cesàro means sequence of A114112, corresponding numerators are in A354008. - Bernard Schott, May 14 2022
Also, denominators of Cesàro means sequence of A237420, corresponding numerators are in A354280. - Bernard Schott, May 22 2022

Programs

  • Maple
    a:= n-> n+1-(n-1)*(n mod 2): seq(a(n), n=0..96); # Wesley Ivan Hurt, Jun 05 2013
  • Mathematica
    Flatten[Table[{2 n - 1, 2}, {n, 40}]] (* Alonso del Arte, Jun 15 2013 *)
    Riffle[Range[1, 79, 2], 2] (* Alonso del Arte, Jun 14 2013 *)
    Table[((-1)^n (n - 1) + n + 3)/2, {n, 0, 20}] (* Eric W. Weisstein, Apr 11 2018 *)
    Table[Floor[(n + 1)/2]/(n + 1), {n, 0, 20}] // Denominator (* Eric W. Weisstein, Apr 11 2018 *)
    LinearRecurrence[{0, 2, 0, -1}, {2, 3, 2, 5}, {0, 20}] (* Eric W. Weisstein, Apr 11 2018 *)
    CoefficientList[Series[(1 + 2 x + x^2 - 2 x^3)/(-1 + x^2)^2, {x, 0, 20}], x] (* Eric W. Weisstein, Apr 11 2018 *)
  • PARI
    A141310(n) = if(n%2,2,1+n); \\ (for offset=0 version) - Antti Karttunen, Oct 02 2018
    
  • PARI
    A141310off1(n) = if(n%2,n,2); \\ (for offset=1 version) - Antti Karttunen, Oct 02 2018
    
  • Python
    def A141310(n): return 2 if n % 2 else n + 1 # Chai Wah Wu, May 24 2022

Formula

a(2n) = A005408(n). a(2n+1) = 2.
First differences: a(n+1) - a(n) = (-1)^(n+1)*A109613(n-1), n > 0.
b(2n) = -A008586(n), and b(2n+1) = A060747(n), where b(n) = a(n+1) - 2*a(n).
a(n) = 2*a(n-2) - a(n-4). - R. J. Mathar, Feb 23 2009
G.f.: (1+2*x+x^2-2*x^3)/((x-1)^2*(1+x)^2). - R. J. Mathar, Feb 23 2009
From Wesley Ivan Hurt, Jun 05 2013: (Start)
a(n) = n + 1 - (n - 1)*(n mod 2).
a(n) = (n + 1) * (n - floor((n+1)/2))! / floor((n+1)/2)!.
a(n) = A000142(n+1) / A211374(n+1). (End)

Extensions

Edited by R. J. Mathar, Feb 23 2009
Term a(45) corrected, and more terms added by Antti Karttunen, Oct 02 2018

A381534 A084849 interleaved with positive even numbers.

Original entry on oeis.org

1, 2, 4, 4, 11, 6, 22, 8, 37, 10, 56, 12, 79, 14, 106, 16, 137, 18, 172, 20, 211, 22, 254, 24, 301, 26, 352, 28, 407, 30, 466, 32, 529, 34, 596, 36, 667, 38, 742, 40, 821, 42, 904, 44, 991, 46, 1082, 48, 1177, 50, 1276, 52
Offset: 1

Author

Ali Sada, Feb 26 2025

Keywords

Comments

To construct the sequence, we start with two 1’s on separate lines:
1,
1,
Next, we zigzag natural numbers between the lines, leaving spaces:
1,,3,,5,,7,,9,,11,...
1,2,,4,,6,,8,,10,_...
To fill the spaces, we insert the sum of the numbers in the previous column:
1, 2, 3, 7, 5, 16, 7, 29, 9, 46, 11, 67...
1, 2, 4, 4, 11, 6, 22, 8, 37, 10, 56,...
a(n) is the second sequence. The first sequence is A354008(k), for k > 2.
The first sequence is odd numbers interleaved with A130883. (From M. F. Hasler via Seqfan.)
The numbers we find by adding the columns are: 2,4,7,11,16,22,29,37,46,56,67,…. which is A000124 (n >= 1). The sequence is constructed by alternating the even indexed terms of this sequence (1,4,11,22,37,56…) with the numbers (added by “zigzag” to the second row before we add the columns to get the missing numbers); namely the even numbers 2*n (n >= 1). Therefore, the sequence seems to be A000124(2n) (n>=0), interleaved with A005843(n); (n>=1). (From David James Sycamore via Seqfan.)

Examples

			A084849(0) = 1, so a(1) = 1.
a(2) is the first positive even number, 2.
		

Crossrefs

Programs

  • Mathematica
    LinearRecurrence[{0,3,0,-3,0,1},{1,2,4,4,11,6},60] (* Harvey P. Dale, May 09 2025 *)

Formula

G.f.: -x*(-2*x^4+2*x^3-x^2-2*x-1)/(-x^6+3*x^4-3*x^2+1). - Michel Marcus Feb 27 2025
Showing 1-3 of 3 results.