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

A015518 a(n) = 2*a(n-1) + 3*a(n-2), with a(0)=0, a(1)=1.

Original entry on oeis.org

0, 1, 2, 7, 20, 61, 182, 547, 1640, 4921, 14762, 44287, 132860, 398581, 1195742, 3587227, 10761680, 32285041, 96855122, 290565367, 871696100, 2615088301, 7845264902, 23535794707, 70607384120, 211822152361, 635466457082
Offset: 0

Views

Author

Keywords

Comments

Number of walks of length n between any two distinct vertices of the complete graph K_4. - Paul Barry and Emeric Deutsch, Apr 01 2004
For n >= 1, a(n) is the number of integers k, 1 <= k <= 3^(n-1), whose ternary representation ends in an even number of zeros (see A007417). - Philippe Deléham, Mar 31 2004
Form the digraph with matrix A=[0,1,1,1;1,0,1,1;1,1,0,1;1,0,1,1]. A015518(n) corresponds to the (1,3) term of A^n. - Paul Barry, Oct 02 2004
The same sequence may be obtained by the following process. Starting a priori with the fraction 1/1, the denominators of fractions built according to the rule: add top and bottom to get the new bottom, add top and 4 times the bottom to get the new top. The limit of the sequence of fractions is 2. - Cino Hilliard, Sep 25 2005
(A046717(n))^2 + (2*a(n))^2 = A046717(2n). E.g., A046717(3) = 13, 2*a(3) = 14, A046717(6) = 365. 13^2 + 14^2 = 365. - Gary W. Adamson, Jun 17 2006
For n >= 2, number of ordered partitions of n-1 into parts of sizes 1 and 2 where there are two types of 1 (singletons) and three types of 2 (twins). For example, the number of possible configurations of families of n-1 male (M) and female (F) offspring considering only single births and twins, where the birth order of M/F/pair-of-twins is considered and there are three types of twins; namely, both F, both M, or one F and one M - where birth order within a pair of twins itself is disregarded. In particular, for a(3)=7, two children could be either: (1) F, then M; (2) M, then F; (3) F,F; (4) M,M; (5) F,F twins; (6) M,M twins; or (7) M,F twins (emphasizing that birth order is irrelevant here when both/all children are the same gender and when two children are within the same pair of twins). - Rick L. Shepherd, Sep 18 2004
a(n) is prime for n = {2, 3, 5, 7, 13, 23, 43, 281, 359, ...}, where only a(2) = 2 corresponds to a prime of the form (3^k - 1)/4. All prime terms, except a(2) = 2, are the primes of the form (3^k + 1)/4. Numbers k such that (3^k + 1)/4 is prime are listed in A007658. Note that all prime terms have prime indices. Prime terms are listed in A111010. - Alexander Adamchuk, Nov 19 2006
Let A be the Hessenberg matrix of order n, defined by: A[1,j]=1, A[i,i]:=-2, A[i,i-1]=-1, and A[i,j]=0 otherwise. Then, for n>=1, a(n)=charpoly(A,1). - Milan Janjic, Jan 26 2010
Select an odd size subset S from {1,2,...,n}, then select an even size subset from S. - Geoffrey Critzer, Mar 02 2010
a(n) is the number of ternary sequences of length n where the numbers of (0's, 1's) are (even, odd) respectively, and, by symmetry, the number of such sequences where those numbers are (odd, even) respectively. A122983 covers (even, even), and A081251 covers (odd, odd). - Toby Gottfried, Apr 18 2010
An elephant sequence, see A175654. For the corner squares just one A[5] vector, with decimal value 341, leads to this sequence (without the leading 0). For the central square this vector leads to the companion sequence A046717 (without the first leading 1). - Johannes W. Meijer, Aug 15 2010
Let R be the commutative algebra resulting from adjoining the elements of the Klein four-group to the integers (equivalently, K = Z[x,y,z]/{x*y - z, y*z - x, x*z - y, x^2 - 1, y^2 - 1, z^2 - 1}). Then a(n) is equal to the coefficients of x, y, and z in the expansion of (x + y + z)^n. - Joseph E. Cooper III (easonrevant(AT)gmail.com), Nov 06 2010
Pisano period lengths: 1, 2, 2, 4, 4, 2, 6, 8, 2, 4, 10, 4, 6, 6, 4, 16, 16, 2, 18, 4, ... - R. J. Mathar, Aug 10 2012
The ratio a(n+1)/a(n) converges to 3 as n approaches infinity. - Felix P. Muga II, Mar 09 2014
This is a divisibility sequence, also the values of Chebyshev polynomials, and also the number of ways of packing a 2 X n-1 rectangle with dominoes and unit squares. - R. K. Guy, Dec 16 2016
For n>0, gcd(a(n),a(n+1))=1. - Kengbo Lu, Jul 02 2020

References

  • John Derbyshire, Prime Obsession, Joseph Henry Press, April 2004, see p. 16.

Crossrefs

a(n) = A080926(n-1) + 1 = (1/3)*A054878(n+1) = (1/3)*abs(A084567(n+1)).
First differences of A033113 and A039300.
Partial sums of A046717.
The following sequences (and others) belong to the same family: A000129, A001333, A002532, A002533, A002605, A015518, A015519, A026150, A046717, A063727, A083098, A083099, A083100, A084057.
Cf. A046717.

Programs

  • Magma
    [Round(3^n/4): n in [0..30]]; // Vincenzo Librandi, Jun 24 2011
    
  • Mathematica
    Table[(3^n-(-1)^n)/4,{n,0,30}] (* Alexander Adamchuk, Nov 19 2006 *)
  • Maxima
    a(n):= round(3^n/4)$ /* Dimitri Papadopoulos, Nov 28 2023 */
  • PARI
    a(n)=round(3^n/4)
    
  • Python
    for n in range(0, 20): print(int((3**n-(-1)**n)/4), end=', ') # Stefano Spezia, Nov 30 2018
    
  • Sage
    [round(3^n/4) for n in range(0,27)]
    

Formula

G.f.: x/((1+x)*(1-3*x)).
a(n) = (3^n - (-1)^n)/4 = floor(3^n/4 + 1/2).
a(n) = 3^(n-1) - a(n-1). - Emeric Deutsch, Apr 01 2004
E.g.f.: (exp(3*x) - exp(-x))/4. Second inverse binomial transform of (5^n-1)/4, A003463. Inverse binomial transform for powers of 4, A000302 (when preceded by 0). - Paul Barry, Mar 28 2003
a(n) = Sum_{k=0..floor(n/2)} C(n, 2k+1)*2^(2k). - Paul Barry, May 14 2003
a(n) = Sum_{k=1..n} binomial(n, k)*(-1)^(n+k)*4^(k-1). - Paul Barry, Apr 02 2003
a(n+1) = Sum_{k=0..floor(n/2)} binomial(n-k, k)*2^(n-2*k)*3^k. - Paul Barry, Jul 13 2004
a(n) = U(n-1, i/sqrt(3))(-i*sqrt(3))^(n-1), i^2=-1. - Paul Barry, Nov 17 2003
G.f.: x*(1+x)^2/(1 - 6*x^2 - 8*x^3 - 3*x^4) = x(1+x)^2/characteristic polynomial(x^4*adj(K_4)(1/x)). - Paul Barry, Feb 03 2004
a(n) = sum_{k=0..3^(n-1)} A014578(k) = -(-1)^n*A014983(n) = A051068(3^(n-1)), for n > 0. - Philippe Deléham, Mar 31 2004
E.g.f.: exp(x)*sinh(2*x)/2. - Paul Barry, Oct 02 2004
a(2*n+1) = A054880(n) + 1. - M. F. Hasler, Mar 20 2008
2*a(n) + (-1)^n = A046717(n). - M. F. Hasler, Mar 20 2008
a(n) = ((1+sqrt(4))^n - (1-sqrt(4))^n)/4. - Al Hakanson (hawkuu(AT)gmail.com), Dec 31 2008
a(n) = abs(A014983(n)). - Zerinvary Lajos, May 28 2009
a(n) = round(3^n/4). - Mircea Merca, Dec 28 2010
a(n) = Sum_{k=1,3,5,...} binomial(n,k)*2^(k-1). - Geoffrey Critzer, Mar 02 2010
From Sergei N. Gladkovskii, Jul 19 2012: (Start)
G.f.: G(0)/4 where G(k)= 1 - 1/(9^k - 3*x*81^k/(3*x*9^k - 1/(1 + 1/(3*9^k - 27*x*81^k/(9*x*9^k + 1/G(k+1)))))); (continued fraction).
E.g.f.: G(0)/4 where G(k)= 1 - 1/(9^k - 3*x*81^k/(3*x*9^k - (2*k+1)/(1 + 1/(3*9^k - 27*x*81^k/(9*x*9^k + (2*k+2)/G(k+1)))))); (continued fraction). (End)
G.f.: G(0)*x/(2*(1-x)), where G(k) = 1 + 1/(1 - x*(4*k-1)/(x*(4*k+3) - 1/G(k+1))); (continued fraction). - Sergei N. Gladkovskii, May 26 2013
a(n+1) = Sum_{k = 0..n} A238801(n,k)*2^k. - Philippe Deléham, Mar 07 2014
a(n) = (-1)^(n-1)*Sum_{k=0..n-1} A135278(n-1,k)*(-4)^k = (-1)^(n-1)*Sum_{k=0..n-1} (-3)^k. Equals (-1)^(n-1)*Phi(n,-3), where Phi is the cyclotomic polynomial when n is an odd prime. (For n > 0.) - Tom Copeland, Apr 14 2014
a(n) = 2*A006342(n-1) - n mod 2 if n > 0, a(0)=0. - Yuchun Ji, Nov 30 2018
a(n) = 2*A033113(n-2) + n mod 2 if n > 0, a(0)=0. - Yuchun Ji, Aug 16 2019
a(2*k) = 2*A002452(k), a(2*k+1) = A066443(k). - Yuchun Ji, Aug 14 2019
a(n+1) = 2*Sum_{k=0..n} a(k) if n odd, and 1 + 2*Sum_{k=0..n} a(k) if n even. - Kengbo Lu, May 30 2020
a(n) = F(n) + Sum_{k=1..(n-1)} a(k)*L(n-k), for F(n) and L(n) the Fibonacci and Lucas numbers. - Kengbo Lu and Greg Dresden, Jun 05 2020
From Kengbo Lu, Jun 11 2020: (Start)
a(n) = A002605(n) + Sum_{k = 1..n-2} a(k)*A002605(n-k-1).
a(n) = A006130(n-1) + Sum_{k = 1..n-1} a(k)*A006130(n-k-1). (End)
a(2n) = Sum_{i>=0, j>=0} binomial(n-j-1,i)*binomial(n-i-1,j)* 2^(2n-2i-2j-1)* 3^(i+j). - Kengbo Lu, Jul 02 2020
a(n) = 3*a(n-1) - (-1)^n. - Dimitri Papadopoulos, Nov 28 2023
G.f.: x/((1 + x)*(1 - 3*x)) = Sum_{n >= 0} x^(n+1) * Product_{k = 1..n} (k + 3*x + 1)(1 + k*x) (a telescoping series). Cf. A007482. - Peter Bala, May 08 2024
From Peter Bala, Jun 29 2025: (Start)
For n >= 1, a(n+1) = 2^n * hypergeom([1/2 - (1/2)*n, -(1/2)*n], [-n], -3).
G.f. A(x) = x*exp(Sum_{n >= 1} a(2*n)/a(n)*x^n/n) = x + 2*x^2 + 7*x^3 + 20*x^4 + ....
sqrt(A(x)/x) is the g.f. of A002426.
The following series telescope:
Sum_{n >= 1} (-3)^n/(a(n)*a(n+1)) = -1; Sum_{n >= 1} (-3)^n/(a(n)*a(n+1)*a(n+2)*a(n+3)) = -1/98.
In general, for k >= 0, Sum_{n >= 1} (-3)^n/(a(n)*a(n+1)*...*a(n+2*k+1)) = -1/((a(1)*a(2)*...*a(2*k+1))*a(2*k+1)).
Sum_{n >= 1} 3^n/(a(n)*a(n+1)*a(n+2)) = 1/4; Sum_{n >= 1} 3^n/(a(n)*a(n+1)*a(n+2)* a(n+3)*a(n+4)) = 1/5600.
In general, for k >= 1, Sum_{n >= 1} 3^n/(a(n)*a(n+1)*...*a(n+2*k)) = 1/((a(1)*a(2)*...*a(2*k))*a(2*k)). (End)

Extensions

More terms from Emeric Deutsch, Apr 01 2004
Edited by Ralf Stephan, Aug 30 2004

A002452 a(n) = (9^n - 1)/8.

Original entry on oeis.org

0, 1, 10, 91, 820, 7381, 66430, 597871, 5380840, 48427561, 435848050, 3922632451, 35303692060, 317733228541, 2859599056870, 25736391511831, 231627523606480, 2084647712458321, 18761829412124890, 168856464709124011, 1519708182382116100, 13677373641439044901, 123096362772951404110
Offset: 0

Views

Author

Keywords

Comments

From David W. Wilson: Numbers triangular, differences square.
To be precise, the differences are the squares of the powers of three with positive indices. Hence a(n+1) - a(n) = (A000244(n+1))^2 = A001019(n+1). [Added by Ant King, Jan 05 2011]
Partial sums of A001019. This is m-th triangular number, where m is partial sums of A000244. a(n) = A000217(A003462(n)). - Lekraj Beedassy, May 25 2004
With offset 0, binomial transform of A003951. - Philippe Deléham, Jul 22 2005
Numbers in base 9: 1, 11, 111, 1111, 11111, 111111, 1111111, etc. - Zerinvary Lajos, Apr 26 2009
Let A be the Hessenberg matrix of order n, defined by: A[1,j]=1, A[i,i]:=9, (i>1), A[i,i-1]=-1, and A[i,j]=0 otherwise. Then, for n>=1, a(n)=det(A). - Milan Janjic, Feb 21 2010
Let A be the Hessenberg matrix of order n, defined by: A[1,j]=1, A[i,i]:=10, (i>1), A[i,i-1]=-1, and A[i,j]=0 otherwise. Then, for n >= 2, a(n-1) = (-1)^n*charpoly(A,1). - Milan Janjic, Feb 21 2010
From Hieronymus Fischer, Jan 30 2013: (Start)
Least index k such that A052382(k) >= 10^(n-1), for n > 0.
Also index k such that A052382(k) = (10^n-1)/9, n > 0.
A052382(a(n)) is the least zerofree number with n digits, for n > 0.
For n > 1: A052382(a(n)-1) is the greatest zerofree number with n-1 digits. (End)
For n > 0, 4*a(n) is the total number of holes in a certain triangle fractal (start with 9 triangles, 4 holes) after n iterations. See illustration in links. - Kival Ngaokrajang, Feb 21 2015
For n > 0, a(n) is the sum of the numerators and denominators of the reduced fractions 0 < (b/3^(n-1)) < 1 plus 1. Example for n=3 gives fractions 1/9, 2/9, 1/3, 4/9, 5/9, 2/3, 7/9, and 8/9 plus 1 has sum of numerators and denominators +1 = a(3) = 91. - J. M. Bergot, Jul 11 2015
Except for 0 and 1, all terms are Brazilian repunits numbers in base 9, so belong to A125134. All these terms are composite because a(n) is the ((3^n - 1)/2)-th triangular number. - Bernard Schott, Apr 23 2017
These are also the second steps after the junctions of the Collatz trajectories of 2^(2k-1)-1 and 2^2k-1. - David Rabahy, Nov 01 2017

Examples

			a(4) = (9^4 - 1)/8 = 820 = 1111_9 = (1/2) * 40 * 41 is the ((3^4 - 1)/2)-th = 40th triangular number. - _Bernard Schott_, Apr 23 2017
		

References

  • A. Fletcher, J. C. P. Miller, L. Rosenhead, and L. J. Comrie, An Index of Mathematical Tables. Vols. 1 and 2, 2nd ed., Blackwell, Oxford and Addison-Wesley, Reading, MA, 1962, Vol. 1, p. 112.
  • J. Riordan, Combinatorial Identities, Wiley, 1968, p. 217.
  • 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).
  • T. N. Thiele, Interpolationsrechnung. Teubner, Leipzig, 1909, p. 36.

Crossrefs

Right-hand column 1 in triangle A008958.

Programs

Formula

From Philippe Deléham, Mar 13 2004: (Start)
a(n) = 9*a(n-1) + 1; a(1) = 1.
G.f.: x / ((1-x)*(1-9*x)). (End)
a(n) = 10*a(n-1) - 9*a(n-2). - Ant King, Jan 05 2011
a(n) = floor(A000217(3^n)/4) - A033113(n-1). - Arkadiusz Wesolowski, Feb 14 2012
Sum_{n>0} a(n)*(-1)^(n+1)*x^(2*n+1)/(2*n+1)! = (1/6)*sin(x)^3. - Vladimir Kruchinin, Sep 30 2012
a(n) = A011540(A217094(n-1)) - A217094(n-1) + 2, n > 0. - Hieronymus Fischer, Jan 30 2013
a(n) = 10^(n-1) + 2 - A217094(n-1). - Hieronymus Fischer, Jan 30 2013
a(n) = det(|v(i+2,j+1)|, 1 <= i,j <= n-1), where v(n,k) are central factorial numbers of the first kind with odd indices (A008956) and n > 0. - Mircea Merca, Apr 06 2013
a(n) = Sum_{k=0..n-1} 9^k. - Doug Bell, May 26 2017
E.g.f.: exp(5*x)*sinh(4*x)/4. - Stefano Spezia, Mar 11 2023

Extensions

More terms from Pab Ter (pabrlos(AT)yahoo.com), May 08 2004
Offset changed from 1 to 0 and added 0 by Vincenzo Librandi, Jun 01 2011

A128174 Transform, (1,0,1,...) in every column.

Original entry on oeis.org

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

Views

Author

Gary W. Adamson, Feb 17 2007

Keywords

Comments

Inverse of the triangle = a tridiagonal matrix with (1,1,1,...) in the superdiagonal, (0,0,0,...) in the main diagonal and (-1,-1,-1,...) in the subdiagonal.
Riordan array (1/(1-x^2), x) with inverse (1-x^2,x). - Paul Barry, Sep 10 2008
The position of 1's in this sequence is equivalent to A246705, and the position of 0's is equivalent to A246706. - Bernard Schott, Jun 05 2019

Examples

			First few rows of the triangle are:
  1;
  0, 1;
  1, 0, 1;
  0, 1, 0, 1;
  1, 0, 1, 0, 1; ...
		

Crossrefs

Cf. A004526 (row sums).

Programs

  • Haskell
    a128174 n k = a128174_tabl !! (n-1) !! (k-1)
    a128174_row n = a128174_tabl !! (n-1)
    a128174_tabl = iterate (\xs@(x:_) -> (1 - x) : xs) [1]
    -- Reinhard Zumkeller, Aug 01 2014
    
  • Magma
    [[(1+(-1)^(n-k))/2: k in [1..n]]: n in [1..12]]; // G. C. Greubel, Jun 05 2019
    
  • Maple
    A128174 := proc(n,k)
        if k > n or k < 1 then
            0;
        else
            modp(k+n+1,2) ;
        end if;
    end proc: # R. J. Mathar, Aug 06 2016
  • Mathematica
    a128174[r_] := Table[If[EvenQ[n+k], 1, 0], {n, 1, r}, {k, 1, n}]
    TableForm[a128174[5]] (* triangle *)
    Flatten[a128174[10]] (* data *) (* Hartmut F. W. Hoft, Mar 15 2017 *)
    Table[(1+(-1)^(n-k))/2, {n,1,12}, {k,1,n}]//Flatten (* G. C. Greubel, Sep 26 2017 *)
  • PARI
    for(n=1,12, for(k=1,n, print1((1+(-1)^(n-k))/2, ", "))) \\ G. C. Greubel, Sep 26 2017
    
  • Sage
    [[(1+(-1)^(n-k))/2 for k in (1..n)] for n in (1..12)] # G. C. Greubel, Jun 05 2019

Formula

A lower triangular matrix transform, (1, 0, 1, ...) in every column; n terms of (1, 0, 1, ...) in odd rows; n terms of (0, 1, 0, ...) in even rows.
T(n,k) = [k<=n]*(1+(-1)^(n-k))/2. - Paul Barry, Sep 10 2008
With offset n=1, k=0: Sum_{k=0..n} {T(n,k)*x^k} = A000035(n), A004526(n+1), A000975(n), A033113(n), A033114(n), A033115(n), A033116(n), A033117(n), A033118(n), A033119(n), A056830(n+1) for x=0,1,2,3,4,5,6,7,8,9,10 respectively. - Philippe Deléham, Oct 17 2011
T(n+1,1) = 1 - T(n,1); T(n+1,k) = T(n,k-1), 1 < k <= n+1. - Reinhard Zumkeller, Aug 01 2014

A056830 Alternate digits 1 and 0.

Original entry on oeis.org

0, 1, 10, 101, 1010, 10101, 101010, 1010101, 10101010, 101010101, 1010101010, 10101010101, 101010101010, 1010101010101, 10101010101010, 101010101010101, 1010101010101010, 10101010101010101, 101010101010101010
Offset: 0

Views

Author

Henry Bottomley, Aug 30 2000

Keywords

Comments

Fibonacci bit-representations of numbers for which there is only one possible representation and for which the maximal and minimal bit-representations (A104326 and A014417) are equal. The numbers represented are equal to the numbers in A000071 (subtract the first term of that sequence). For example, 10101 = 12 because 8+5+1. - Casey Mongoven, Mar 19 2006
Sequence A000975 written in base 2. - Jaroslav Krizek, Aug 05 2009
The absolute value of alternating sum of the first n repunits: a(n) = abs(Sum_{k=0..n} (-1)^k*A002275(n)). - Ilya Gutkovskiy, Dec 02 2015
Binary representation of the x-axis, from the origin to the right edge, of the n-th stage of growth of the two-dimensional cellular automaton defined by "Rule 131", based on the 5-celled von Neumann neighborhood. See A279053 for references and links. - Robert Price, Dec 05 2016

Examples

			n  a(n)             A000975(n)   (If a(n) is interpreted in base 2.)
------------------------------
0  0 ....................... 0
1  1 ....................... 1
2  10 ...................... 2 = 2^1
3  101 ..................... 5
4  1010 ................... 10 = 2^1 + 2^3
5  10101 .................. 21
6  101010 ................. 42 = 2^1 + 2^3 + 2^5
7  1010101 ................ 85
8  10101010 .............. 170 = 2^1 + 2^3 + 2^5 + 2^7
9  101010101 ............. 341
10 1010101010 ............ 682 = 2^1 + 2^3 + 2^5 + 2^7 + 2^9
11 10101010101 .......... 1365
12 101010101010 ......... 2730 = 2^1 + 2^3 + 2^5 + 2^7 + 2^9 + 2^11, etc.
- _Bruno Berselli_, Dec 02 2015
		

Crossrefs

Programs

  • GAP
    List([0..30], n-> Int(10^(n+1)/99) ); # G. C. Greubel, Jul 14 2019
  • Magma
    [Round((20*10^n-11)/198) : n in [0..30]]; // Vincenzo Librandi, Jun 25 2011
    
  • Maple
    A056830 := proc(n) floor(10^(n+1)/99) ; end proc:
  • Mathematica
    CoefficientList[Series[x/((1-x^2)*(1-10*x)), {x,0,30}], x] (* G. C. Greubel, Sep 26 2017 *)
  • PARI
    Vec(x/((1-x)*(1+x)*(1-10*x))+O(x^30)) \\ Charles R Greathouse IV, Feb 13 2017
    
  • Sage
    [floor(10^(n+1)/99) for n in (0..30)] # G. C. Greubel, Jul 14 2019
    

Formula

a(n) = +10*a(n-1) + a(n-2) - 10*a(n-3).
a(n) = floor(10^(n+1)/(10^2-1)) = a(n-2)+10^(n-1) = 10*a(n-1) + (1 - (-1)^n)/2.
From Paul Barry, Nov 12 2003: (Start)
a(n+1) = Sum_{k=0..floor(n/2)} 10^(n-2*k).
a(n+1) = Sum_{k=0..n} Sum_{j=0..k} (-1)^(j+k)*10^j.
G.f.: x/((1-x)*(1+x)*(1-10*x)).
a(n) = 9*a(n-1) + 10*a(n-2) + 1.
a(n) = 10^(n+1)/99 - (-1)^n/22 - 1/18. (End)
a(n) = A007088(A107909(A104161(n))) = A007088(A000975(n)). - Reinhard Zumkeller, May 28 2005
a(n) = round((20*10^n-11)/198) = floor((10*10^n-1)/99) = ceiling((10*10^n-10)/99) = round((10*10^n-10)/99). - Mircea Merca, Dec 27 2010
From Daniel Forgues, Sep 20 2018: (Start)
If a(n) is interpreted in base 2:
a(2n) = Sum_{k=1..n} 2^(2n-1), n >= 0; a(2n-1) = a(2n)/2, n >= 1.
a(2n) = A020988(n), n >= 0.
a(0) = 0; a(2n) = 4*a(2n-2) + 2, n >= 1. (End)

Extensions

More terms from Casey Mongoven, Mar 19 2006

A032858 Numbers whose base-3 representation Sum_{i=0..m} d(i)*3^i has d(m) > d(m-1) < d(m-2) > ...

Original entry on oeis.org

0, 1, 2, 3, 6, 7, 10, 11, 19, 20, 23, 30, 33, 34, 57, 60, 61, 69, 70, 91, 92, 100, 101, 104, 172, 173, 181, 182, 185, 208, 209, 212, 273, 276, 277, 300, 303, 304, 312, 313, 516, 519, 520, 543, 546, 547, 555, 556, 624, 627, 628, 636, 637
Offset: 1

Views

Author

Keywords

Comments

Every other base-3 digit must be strictly less than its neighbors. - M. F. Hasler, Oct 05 2018
The terms can be generated in the following way: if A(n) are the terms with n digits in base 3, the terms with n+2 digits are obtained by prefixing them with '10' and with '20', and prefixing '21' to those starting with a digit '2'. It is easy to prove that #A(n) = A000045(n+2), since from the above we have #A(n+2) = 2*#A(n) + #A(n-1) = #A(n) + #A(n+1). (The #A(n-1) numbers starting with '2' are #A(n-2) numbers prefixed with '20' and #A(n-3) prefixed with '21'.) - M. F. Hasler, Oct 05 2018

Examples

			The base-3 representation of the initial terms is 0, 1, 2, 10, 20, 21, 101, 102, 201, 202, 212, 1010, 1020, 1021, 2010, 2020, 2021, 2120, 2121, 10101, 10102, ...
		

Crossrefs

Cf. A032859 .. A032865 for base-4 .. 10 variants.
Cf. A000975 (or A056830 in binary) for the base-2 analog.
Cf. A306105 for these terms written in base 3.

Programs

  • Mathematica
    sdQ[n_]:=Module[{s=Sign[Differences[IntegerDigits[n, 3]]]}, s==PadRight[{}, Length[s], {-1, 1}]]; Select[Range[0, 700], sdQ] (* Vincenzo Librandi, Oct 06 2018 *)
  • PARI
    is(n,b=3)=!for(i=2,#n=digits(n,b),(n[i-1]-n[i])*(-1)^i>0||return) \\ M. F. Hasler, Oct 05 2018

Formula

a(A000071(n+3)) = floor(3^(n+1)/8) = A033113(n). - M. F. Hasler, Oct 05 2018

Extensions

Definition edited, cross-references and a(1) = 0 inserted by M. F. Hasler, Oct 05 2018

A081251 Numbers n such that A081249(m)/m^2 has a local maximum for m = n.

Original entry on oeis.org

2, 6, 20, 60, 182, 546, 1640, 4920, 14762, 44286, 132860, 398580, 1195742, 3587226, 10761680, 32285040, 96855122, 290565366, 871696100, 2615088300, 7845264902, 23535794706, 70607384120, 211822152360, 635466457082, 1906399371246
Offset: 1

Views

Author

Klaus Brockhaus, Mar 17 2003

Keywords

Comments

The limit of the local maxima, lim A081249(n)/n^2 = 1/6. For local minima cf. A081250.
Also the number of different 4- and 3-colorings for the vertices of all triangulated planar polygons on a base with n+2 vertices, if the colors of the two base vertices are fixed. - Patrick Labarque, Mar 23 2010
From Toby Gottfried, Apr 18 2010: (Start)
a(n) = the number of ternary sequences of length n+1 where the numbers of (0's, 1's) are both odd.
A015518 covers the (odd, even) and (even, odd) cases, and A122983 covers (even, even). (End)

Examples

			6 is a term since A081249(5)/5^2 = 4/25 = 0.160, A081249(6)/6^2 = 7/36 = 0.194, A081249(7)/7^2 = 9/49 = 0.184.
		

Crossrefs

Programs

  • GAP
    List([1..30], n-> (9*3^(n-1) -(-1)^n -2)/4); # G. C. Greubel, Jul 14 2019
  • Magma
    [Floor(3^(n+1)/4) : n in [1..30]]; // Vincenzo Librandi, Jun 25 2011
    
  • Maple
    seq(floor(3^(n+1)/4), n=1..30). # Mircea Merca, Dec 27 2010
  • Mathematica
    a[n_]:= Floor[3^(n+1)/4]; Array[a, 30]
    Table[(9*3^(n-1) -(-1)^n -2)/4, {n, 1, 30}] (* G. C. Greubel, Jul 14 2019 *)
  • PARI
    vector(30, n, (9*3^(n-1) -(-1)^n -2)/4) \\ G. C. Greubel, Jul 14 2019
    
  • Sage
    [(9*3^(n-1) -(-1)^n -2)/4 for n in (1..30)] # G. C. Greubel, Jul 14 2019
    

Formula

G.f.: 2/((1-x)*(1+x)*(1-3*x)).
a(n) = a(n-2) + 2*3^(n) for n > 1.
a(n+2) - a(n) = A008776(n).
a(n) = 2*A033113(n+1).
a(2*n+1) = A054880(n+1).
a(n) = floor(3^(n+1)/4). - Mircea Merca, Dec 26 2010
From G. C. Greubel, Jul 14 2019: (Start)
a(n) = (9*3^(n-1) -(-1)^n -2)/4.
E.g.f.: (3*exp(3*x) - 2*exp(x) - exp(-x))/4. (End)

A043555 Number of runs in base-3 representation of n.

Original entry on oeis.org

1, 1, 1, 2, 1, 2, 2, 2, 1, 2, 3, 3, 2, 1, 2, 3, 3, 2, 2, 3, 3, 3, 2, 3, 2, 2, 1, 2, 3, 3, 4, 3, 4, 4, 4, 3, 2, 3, 3, 2, 1, 2, 3, 3, 2, 3, 4, 4, 4, 3, 4, 3, 3, 2, 2, 3, 3, 4, 3, 4, 4, 4, 3, 3, 4, 4, 3, 2, 3, 4, 4, 3, 2, 3, 3, 3, 2, 3, 2, 2, 1, 2, 3, 3, 4, 3, 4, 4, 4, 3
Offset: 0

Views

Author

Keywords

Comments

Every positive integer occurs infinitely many times. See A297770 for a guide to related sequences.
Having a(0) = 1 (rather than a(0) = 0) is debatable, on the grounds that a(0) = 1 is determined by our culture, rather than the underlying mathematics. See my August 2020 comment in A145204. - Peter Munn, Jul 12 2024
From M. F. Hasler, Jul 13 2024: (Start)
The base-2 version has a(0) = 0, corresponding to the convention that 0 has zero digits, which is the more logical (but maybe less human) convention, such that, e.g., b^n is the least number with n+1 digits in base b (<=> b^n - 1 is the largest number with n digits), valid also for 0. Here and in A043556 (base 4) the convention is that 0 has one digit, '0'.
"Runs" means substrings of consecutive equal digits, here in the base-3 representation of the numbers. See Example for details. (End)

Examples

			From _M. F. Hasler_, Jul 13 2024: (Start)
Numbers n = 0, 1, 2, 3, 4, 5, ... are written '0', '1', '2', '10', '11', '12', ... in base 3. The first three have one single digit, so there is just 1 "run" (= subsequence of equal digits), whence a(0) = a(1) = a(2) = 1.
In '10' we have a "run" of '1's of length 1, followed by a run of '0's of length 1, so there are a(3) = 2 runs.
In '11' we have again one single run, here of 2 digits '1', whence a(4) = 1. (End)
		

Crossrefs

Cf. A005811 (in base 2), A043556 (in base 4), A145204, A297770, A297771 (number of distinct runs).
Cf. A033113.

Programs

  • Maple
    NRUNS := proc(L::list)
        local a,i;
        a := 1 ;
        for i from 2 to nops(L) do
            if op(i,L) <> op(i-1,L) then
                a := a+1 ;
            end if
        end do:
        a ;
    end proc:
    A043555 := proc(n)
        convert(n,base,3) ;
        NRUNS(%) ;
    end proc:
    seq(A043555(n),n=0..80) ; # R. J. Mathar, Jul 12 2024
    # second Maple program:
    a:= n-> `if`(n<3, 1, a(iquo(n, 3))+`if`(n mod 9 in {0, 4, 8}, 0, 1)):
    seq(a(n), n=0..89);  # Alois P. Heinz, Jul 13 2024
  • Mathematica
    b = 3; s[n_] := Length[Split[IntegerDigits[n, b]]];
    Table[s[n], {n, 1, 200}]
  • PARI
    a(n)=my(d=digits(n,3)); sum(i=2,#d,d[i]!=d[i-1])+1 \\ Charles R Greathouse IV, Jul 20 2014
    
  • Python
    from itertools import groupby
    from sympy.ntheory import digits
    def A043555(n): return len(list(groupby(digits(n,3)[1:]))) # Chai Wah Wu, Jul 13 2024

Extensions

Updated by Clark Kimberling, Feb 03 2018

A039300 Number of distinct quadratic residues mod 3^n.

Original entry on oeis.org

1, 2, 4, 11, 31, 92, 274, 821, 2461, 7382, 22144, 66431, 199291, 597872, 1793614, 5380841, 16142521, 48427562, 145282684, 435848051, 1307544151, 3922632452, 11767897354, 35303692061, 105911076181, 317733228542, 953199685624
Offset: 0

Views

Author

Keywords

Comments

Number of distinct n-digit suffixes of base 3 squares.
In general, for any odd prime p, the number s of quadratic residues mod p^n is given by s = (p^(n+1) + p + 2)/(2p + 2) for even n and s = (p^(n+1) + 2*p + 1)/(2p + 2) for odd n, see A000224. - Lekraj Beedassy, Jan 07 2005

References

  • J. V. Uspensky and M. A. Heaslet, Elementary Number Theory, McGraw-Hill, NY, 1939, p. 324.

Crossrefs

Programs

  • GAP
    List([0..30], n-> (3^(n+1) +6 -(-1)^n)/8); # G. C. Greubel, Jul 14 2019
  • Magma
    [(3^(n+1) + 6 + (-1)^(n+1))/8: n in [0..30]]; // Vincenzo Librandi, Apr 21 2012
    
  • Maple
    A039300 := proc(n)
        floor((3^n+3)*3/8) ;
    end proc:
    seq(A039300(n),n=0..30) ; # R. J. Mathar, Sep 28 2017
  • Mathematica
    CoefficientList[Series[(1-x-3x^2)/((1-x)(1+x)(1-3x)),{x,0,30}],x] (* Vincenzo Librandi, Apr 21 2012 *)
    Table[Floor((3^n+3)*3/8),{n,0,30}] (* Bruno Berselli, Apr 21 2012 *)
    CoefficientList[Series[1/8 E^-x (-1 + 6 E^(2 x) + 3 E^(4 x)), {x, 0, 30}], x]*Table[k!, {k, 0, 30}] (* Stefano Spezia, Sep 04 2018 *)
  • PARI
    {a(n) = if(n<0, 0, 3^n*3\8 + 1)}; /* Michael Somos,Mar 27 2005 */
    
  • PARI
    {a(n) = if(n<1, n==0, 3*a(n-1) - 2 + n%2)}; /* Michael Somos, Mar 27 2005 */
    
  • Sage
    [(3^(n+1) +6 -(-1)^n)/8 for n in (0..30)] # G. C. Greubel, Jul 14 2019
    

Formula

a(n) = floor(3*(3^n + 3)/8).
a(n) = A033113(n) + 1.
a(n) = (3^(n+1) + 6 + (-1)^(n+1))/8. - Lekraj Beedassy, Jan 07 2005
G.f.: (1 - x - 3*x^2)/((1 - x)*(1 + x)*(1 - 3*x)). - Michael Somos, Mar 27 2005
a(n) = 2*a(n-1) + 3*a(n-2) - 3 with n > 1, a(0) = 1, a(1) = 1. - Zerinvary Lajos, Dec 14 2008
a(n) = 3*a(n-1) + a(n-2) - 3*a(n-3). Vincenzo Librandi, Apr 21 2012
a(n) = A000224(3^n). - R. J. Mathar, Sep 28 2017
E.g.f.: (1/8)*exp(-x)*(-1+6*exp(2*x)+3*exp(4*x)). - Stefano Spezia, Sep 04 2018

A104721 Expansion of (1+x)^2/(1-4*x^2).

Original entry on oeis.org

1, 2, 5, 8, 20, 32, 80, 128, 320, 512, 1280, 2048, 5120, 8192, 20480, 32768, 81920, 131072, 327680, 524288, 1310720, 2097152, 5242880, 8388608, 20971520, 33554432, 83886080, 134217728, 335544320, 536870912, 1342177280, 2147483648
Offset: 0

Views

Author

Paul Barry, Mar 20 2005

Keywords

Comments

Binomial transform is A033113.
Let b(n) = binomial(n-1, (n-1)/2)*(1-(-1)^n)/2 + binomial(n, n/2)*(1+(-1)^n)/2. Then a(n) = Sum_{k=0..n} b(k)*b(n-k).
If a(1)=2 is dropped, sequence becomes identical to A084568 (Proof immediate by standard manipulation of the two generating functions). - R. J. Mathar, May 19 2008

Programs

  • GAP
    Concatenation([1], List([1..40], n-> 9*2^(n-3) -(-2)^(n-3))); # G. C. Greubel, Jul 14 2019
  • Magma
    [1] cat [9*2^(n-3) -(-2)^(n-3): n in [1..40]]; // G. C. Greubel, Jul 14 2019
    
  • Mathematica
    CoefficientList[Series[(1+x)^2/(1-4x^2),{x,0,40}],x] (* or *) LinearRecurrence[{0,4},{1,2,5},40] (* Harvey P. Dale, Dec 05 2015 *)
  • PARI
    vector(40, n, n--; (9*2^n +(-2)^n -2*0^n)/8) \\ G. C. Greubel, Jul 14 2019
    
  • Sage
    [1]+[9*2^(n-3) -(-2)^(n-3) for n in (1..40)] # G. C. Greubel, Jul 14 2019
    

Formula

a(n) = (9*2^n + (-2)^n - 2*0^n)/8.

A059848 As a square table by antidiagonals, the n-digit number which in base k starts 1010101...

Original entry on oeis.org

0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 2, 2, 0, 0, 1, 3, 5, 2, 1, 0, 1, 4, 10, 10, 3, 0, 0, 1, 5, 17, 30, 21, 3, 1, 0, 1, 6, 26, 68, 91, 42, 4, 0, 0, 1, 7, 37, 130, 273, 273, 85, 4, 1, 0, 1, 8, 50, 222, 651, 1092, 820, 170, 5, 0, 0, 1, 9, 65, 350, 1333, 3255, 4369, 2460, 341, 5, 1, 0, 1, 10
Offset: 0

Views

Author

Henry Bottomley, Feb 26 2001

Keywords

Examples

			T(5,3)=10101 base 3=81+9+1=91; T(4,6)=1010 base 6=216+6=222. Table starts {0,0,0,0,...}, {1,1,1,1,...}, {0,1,2,3,...}, {1,2,5,10,...}, ...
		

Crossrefs

Formula

T(n, k)=floor[k^(n+1)/(k^2-1)] =T(n-2, k)+k^(n-1) =k*T(n-1, k)-((-1)^n-1)/2
Showing 1-10 of 16 results. Next