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

A001057 Canonical enumeration of integers: interleaved positive and negative integers with zero prepended.

Original entry on oeis.org

0, 1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7, 8, -8, 9, -9, 10, -10, 11, -11, 12, -12, 13, -13, 14, -14, 15, -15, 16, -16, 17, -17, 18, -18, 19, -19, 20, -20, 21, -21, 22, -22, 23, -23, 24, -24, 25, -25, 26, -26, 27, -27, 28, -28, 29, -29, 30, -30, 31, -31
Offset: 0

Views

Author

Keywords

Comments

Go forwards and backwards with increasing step sizes. - Daniele Parisse and Franco Virga, Jun 06 2005
The partial sums of the divergent series 1 - 2 + 3 - 4 + ... give this sequence. Euler summed it to 1/4 which was one of the first examples of summing divergent series. - Michael Somos, May 22 2007
From Peter Luschny, Jul 12 2009: (Start)
The general formula for alternating sums of powers is in terms of the Swiss-Knife polynomials P(n,x) A153641 2^(-n-1)(P(n,1)-(-1)^k P(n,2k+1)). Thus
a(k) = 2^(-2)(P(1,1)-(-1)^k P(1,2k+1)). (End)
Let A be the Hessenberg matrix of order n, defined by: A[1,j]=1, A[i,i]:=-1, A[i,i-1]=-1, and A[i,j]=0 otherwise. Then, for n>=4, a(n-3)=(-1)^(n-1)*coeff(charpoly(A,x),x). - Milan Janjic, Jan 26 2010
Cantor ordering of the integers producing a 1-1 and onto correspondence between the natural numbers and the integers showing that the set Z of integers has the same cardinality as the set N of natural numbers. The cardinal of N is the first transfinite cardinal aleph_null (or aleph_naught), which is the cardinality of a given infinite set if and only if it is countably infinite (denumerable), i.e., it can be put in 1-1 and onto correspondence (with a proper Cantor ordering) with the natural numbers. - Daniel Forgues, Jan 23 2010
a(n) is the determinant of the (n+2) X (n+2) (0,1)-Toeplitz matrix M satisfying: M(i,j)=0 iff i=j or i=j-1. The matrix M arises in the variation of ménage problem where not a round table, but one side of a rectangular table is considered (see comments of Vladimir Shevelev in A000271). Namely M(i,j) defines the class of permutations p of 1,2,...,n+2 such that p(i)<>i and p(i)<>i+1 for i=1,2,...,n+1, and p(n+2)<>n+2. And a(n) is also the difference between the number of even and odd such permutations. - Dmitry Efimov, Mar 02 2017

Examples

			G.f. = x - x^2 + 2*x^3 - 2*x^4 + 3*x^5 - 3*x^6 + 4*x^7 - 4*x^8 + 5*x^9 - 5*x^10 + ...
		

Crossrefs

Cf. A008619, A004526, A166711, A166871, A130472 (negation), A142150 (partial sums), A010551 (partial products for n > 0).
Alternating row sums of A104578 are a(n+1), for n >= 0.

Programs

  • Haskell
    a001057 n = (n' + m) * (-1) ^ (1 - m) where (n',m) = divMod n 2
    a001057_list = 0 : concatMap (\x -> [x,-x]) [1..]
    -- Reinhard Zumkeller, Apr 02 2012
    
  • Maple
    a := n -> (1-(-1)^n*(2*n+1))/4; # Peter Luschny, Jul 12 2009
  • Mathematica
    Join[{0},Riffle[Range[35],-Range[35]]] (* Harvey P. Dale, Sep 21 2011 *)
    a[ n_] := -(-1)^n Ceiling[n/2]; (* Michael Somos, Jun 05 2013 *)
    LinearRecurrence[{-1, 1, 1}, {0, 1, -1}, 63] (* Jean-François Alcover, Jan 07 2019 *)
  • PARI
    {a(n) = if( n%2, n\2 + 1, -n/2)}; /* Michael Somos, Jul 20 1999 */
    
  • Python
    def a(n): return n//2 + 1 if n%2 else -n//2
    print([a(n) for n in range(63)]) # Michael S. Branicky, Jul 14 2022

Formula

Euler transform of [-1, 2] is sequence a(n+1). - Michael Somos, Jun 11 2003
G.f.: x / ((1 + x) * (1 - x^2)). - Michael Somos, Jul 20 1999
E.g.f.: (exp(x) - (1 - 2*x) * exp(-x)) / 4. - Michael Somos, Jun 11 2003
a(n) = 1 - 2*a(n-1) -a(n-2); a(2*n) = -n, a(2*n+1) = n+1. - Michael Somos, Jul 20 1999
|a(n+1)| = A008619(n). |a(n-1)| = A004526(n). - Michael Somos, Jul 20 1999
a(n) = -a(n-1) + a(n-2) + a(n-3). a(n) = (-1)^(n+1) * floor((n+1) / 2). - Michael Somos, Jun 11 2003
a(1) = 1, a(n) = a(n-1)+n or a(n-1)-n whichever is closer to 0 on the number line. Or abs(a(n)) = min{abs(a(n-1)+n), abs(a(n-1)-n)}. - Amarnath Murthy, Jul 01 2003
a(n) = Sum_{k=0..n} k*(-1)^(k+1). - Paul Barry, Aug 20 2003
a(n) = (1-(2n+1)*(-1)^n)/4. - Paul Barry, Feb 02 2004
a(0) = 0; a(n) = (-1)^(n-1) * (n-|a(n-1)|) for n >= 1. - Rick L. Shepherd, Jul 14 2004
a(n) = a(n-1)-n*(-1)^n, a(0)=0; or a(n) = -a(n-1)+(1-(-1)^n)/2, a(0)=0. - Daniele Parisse and Franco Virga, Jun 06 2005
a(n) = ceiling(n/2) * (-1)^(n+1), n >= 0. - Franklin T. Adams-Watters, Nov 25 2011 (corrected by Daniel Forgues, Jul 21 2012)
a(n) = a(-1-n) for all n in Z. - Michael Somos, Jun 05 2013
Sum_{n>=1} 1/a(n) = 0. - Jaume Oliver Lafont, Jul 14 2017

Extensions

Thanks to Michael Somos for helpful comments.
Name edited by Franklin T. Adams-Watters, Jan 30 2012

A009947 Sequence of nonnegative integers, but insert n/2 after every even number n.

Original entry on oeis.org

0, 0, 1, 2, 1, 3, 4, 2, 5, 6, 3, 7, 8, 4, 9, 10, 5, 11, 12, 6, 13, 14, 7, 15, 16, 8, 17, 18, 9, 19, 20, 10, 21, 22, 11, 23, 24, 12, 25, 26, 13, 27, 28, 14, 29, 30, 15, 31, 32, 16, 33, 34, 17, 35, 36, 18, 37, 38, 19, 39, 40, 20, 41, 42, 21, 43, 44, 22, 45, 46
Offset: 0

Views

Author

Keywords

Comments

Coefficients in expansion of e/3 = Sum_{n>=1} a(n)/n!, using greedy algorithm.
Numerators of Peirce sequence of order 2.

References

  • R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics, Addison-Wesley, Reading, MA, 2nd ed. 1998, p. 151.

Crossrefs

Cf. A071281, A214090 (parity), A001477.
Cf. A166711 (signed).

Programs

  • Haskell
    a009947 n = a009947_list !! n
    a009947_list = concatMap (\x -> [2 * x, x, 2 * x + 1]) [0..]
    -- Reinhard Zumkeller, Jul 06 2012
    
  • Maple
    A009947 := proc(a,n) local i,b,c; b := a; c := [ floor(b) ]; for i from 1 to n-1 do b := b-c[ i ]/i!; c := [ op(c), floor(b*(i+1)!) ]; od; c; end:
  • Mathematica
    Flatten[Table[If[EvenQ[n],{n,n/2},n],{n,0,40}]] (* Harvey P. Dale, Feb 17 2016 *)
  • PARI
    a(n)=if(n%3==1, n\3, n\3*2+!!(n%3)) \\ Charles R Greathouse IV, Sep 02 2015
    
  • PARI
    concat(vector(2), Vec(x^2*(x^3+x^2+2*x+1) / ((x-1)^2*(x^2+x+1)^2) + O(x^100))) \\ Colin Barker, Mar 29 2017

Formula

G.f.: x^2*(x^3+x^2+2*x+1) / ((x-1)^2*(x^2+x+1)^2). - Colin Barker, Aug 31 2013
a(n) = (n^2-n+floor(n/3)*(18*floor(n/3)^2-3*(4*n-7)*floor(n/3)+2*n^2-10*n+7))/2. - Luce ETIENNE, Mar 29 2017
Sum_{n>=2} (-1)^n/a(n) = Pi/4 + log(2)/2. - Amiram Eldar, Jan 11 2023

A166871 Permutation of the integers: 3 positives, 2 negatives.

Original entry on oeis.org

0, 1, 2, 3, -1, -2, 4, 5, 6, -3, -4, 7, 8, 9, -5, -6, 10, 11, 12, -7, -8, 13, 14, 15, -9, -10, 16, 17, 18, -11, -12, 19, 20, 21, -13, -14, 22, 23, 24, -15, -16, 25, 26, 27, -17, -18, 28, 29, 30, -19, -20, 31, 32, 33, -21, -22, 34, 35, 36, -23, -24, 37, 38, 39, -25, -26, 40, 41
Offset: 0

Views

Author

Jaume Oliver Lafont, Oct 22 2009

Keywords

Comments

This sequence enumerates the denominators with sign in case p=3 and n=2 of:
log(p/n) = sum( i>=0, sum(p*i+1<=j<=p*(i+1),1/j) - sum(n*i+1<=j<=n*(i+1),1/j) )
Similar sequences can be constructed for the logarithm of any rational r=p/n (p,n>0), enumerating p positive integers and n negative integers every p+n terms.
Case p=2, n=1 is A166711.
Case p=1, n=1 is A001057.

Crossrefs

Programs

  • Mathematica
    LinearRecurrence[{0,0,0,0,2,0,0,0,0,-1},{0,1,2,3,-1,-2,4,5,6,-3}, 100] (* G. C. Greubel, May 27 2016 *)

Formula

Sum_{k>0} 1/a(k) = log(3/2).
G.f.: x*(1+2*x+3*x^2-x^3-2*x^4+2*x^5+x^6-x^8)/((x-1)^2*(x^4+x^3+x^2+x+1)^2 ).

Extensions

keyword frac removed Jaume Oliver Lafont, Nov 02 2009

A167407 T(m,n) is -m if n=0, 1 elsewhere.

Original entry on oeis.org

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

Views

Author

Jaume Oliver Lafont, Nov 03 2009, Nov 04 2009

Keywords

Comments

This triangle encodes a family of conditionally convergent series for the logarithm of positive integers, according to: log(m)=Sum_{n>0} T(m-1,n mod m)/n.
The second row of the triangle, m=1, corresponds to Mercator's series:
log(2)=1-1/2+1/3-1/4+1/5-1/6+-...

Examples

			Triangle begins:
   0;
  -1,1;
  -2,1,1;
  -3,1,1,1;
  -4,1,1,1,1;
  ...
		

Crossrefs

Programs

  • Mathematica
    Flatten[Table[{-n,Table[1,{n}]},{n,0,15}]] (* Harvey P. Dale, Apr 17 2015 *)

Extensions

Revised by Jaume Oliver Lafont, Nov 11 2009

A359027 A line of empty cells is filled by successive terms t >= 1 with t+1 copies of t and gaps of t empty cells between them.

Original entry on oeis.org

1, 2, 1, 3, 4, 2, 5, 6, 2, 3, 7, 8, 4, 3, 9, 10, 5, 3, 11, 4, 12, 6, 13, 14, 4, 5, 7, 15, 16, 4, 8, 6, 5, 17, 18, 9, 19, 7, 5, 20, 6, 10, 21, 22, 5, 8, 11, 23, 6, 7, 24, 12, 9, 25, 26, 6, 13, 8, 7, 27, 10, 28, 6, 14, 29, 30, 9, 7, 11, 8, 15, 31, 32, 16, 12, 7, 10
Offset: 1

Views

Author

Tamas Sandor Nagy, Dec 12 2022

Keywords

Comments

We write 1 into the first cell, then by leaving a gap of one empty cell we write another 1 into the third cell.
Next, we write 2 into the first available empty cell, then write two more 2's by leaving gaps of two empty cells between them. And so on.
It appears that the absolute values of A166711 appear in order nicely embedded into this sequence. - Thomas Scheuerle, Dec 12 2022

Examples

			Cell filling begins, starting from an empty line:
  | | | | | | | | | | | | | | | | | | |
  .
  |1| |1| | | | | | | | | | | | | | | |
  .
  |1|2|1| | |2| | |2| | | | | | | | | |
  .
  |1|2|1|3| |2| | |2|3| | | |3| | | |3|
		

Crossrefs

Cf. A166711.
Cf. A028920 (with infinite copies).

Programs

  • MATLAB
    function a = A359027( max_n )
        a = zeros(1,max_n);
        f = 1:max_n; k = 1;
        while ~isempty(f)
            j = f(1:(k+1):end);
            a(j(j(1:min(k+1,length(j))) <= max_n )) = k;
            k = k+1;
            f = find(a == 0);
        end
    end % Thomas Scheuerle, Dec 12 2022
Showing 1-5 of 5 results.