login
Search: a020988 -id:a020988
     Sort: relevance | references | number | modified | created      Format: long | short | data
A020988 and A007583 interleaved.
+20
7
0, 1, 2, 3, 10, 11, 42, 43, 170, 171, 682, 683, 2730, 2731, 10922, 10923, 43690, 43691, 174762, 174763, 699050, 699051, 2796202, 2796203, 11184810, 11184811, 44739242, 44739243, 178956970, 178956971, 715827882, 715827883, 2863311530, 2863311531, 11453246122
OFFSET
0,3
COMMENTS
a(2*n) = A020988(n), a(2*n+1) = a(2*n) + 1 = A007583(n);
apart from initial zero, record values in A048985: a(n)=A048985(A029744(n)) and a(n)<A048985(m) for m<A029744(n).
FORMULA
a(n) = 2 * (4^floor(n/2) - 1) / 3 + n mod 2.
G.f.: ( -x*(-1-2*x+2*x^2) ) / ( (x-1)*(2*x+1)*(2*x-1)*(1+x) ). - R. J. Mathar, Feb 19 2015
MAPLE
A193652 := proc(n)
if type (n, 'even') then
A020988(n/2) ;
else
A007583(floor(n/2)) ;
end if;
end proc: # R. J. Mathar, Jul 20 2016
MATHEMATICA
LinearRecurrence[{0, 5, 0, -4}, {0, 1, 2, 3}, 35] (* Jean-François Alcover, Dec 16 2021 *)
KEYWORD
nonn,easy
AUTHOR
Reinhard Zumkeller, Aug 08 2011
EXTENSIONS
Terms corrected by R. J. Mathar, Feb 19 2015
STATUS
approved
A020988 written in base 2.
+20
5
10, 1010, 101010, 10101010, 1010101010, 101010101010, 10101010101010, 1010101010101010, 101010101010101010, 10101010101010101010, 1010101010101010101010, 101010101010101010101010, 10101010101010101010101010, 1010101010101010101010101010
OFFSET
1,1
COMMENTS
The digits are n concatenated blocks of (10).
Smallest number having alternating bit sum -n. Cf. A065359. - Washington Bomfim, Jan 22 2011
FORMULA
a(n) = Sum_{k=1..n} 10^(2k-1).
From R. J. Mathar, Jul 08 2009: (Start)
a(n) = 100*a(n-1) + 10.
a(n) = 101*a(n-1) - 100*a(n-2).
G.f.: 10*x/((100*x-1)*(x-1)). (End)
From G. C. Greubel, Aug 01 2017: (Start)
a(n) = (10/99)*(10^(2*n) - 1).
E.g.f.: (10/99)*(exp(100*x) - exp(x)). (End)
MAPLE
A163662 := proc(n) add(10^(2*k-1), k=1..n) ; end: seq(A163662(n), n=1..30) ; # R. J. Mathar, Jul 08 2009
MATHEMATICA
Table[(10/99)*(10^(2*n) - 1), {n, 1, 50}] (* G. C. Greubel, Aug 01 2017 *)
Table[FromDigits[PadRight[{}, 2n, {1, 0}]], {n, 20}] (* or *) LinearRecurrence[ {101, -100}, {10, 1010}, 20] (* Harvey P. Dale, Jan 08 2020 *)
PROG
(PARI) x='x+O('x^50); Vec(10*x/((100*x-1)*(x-1))) \\ G. C. Greubel, Aug 01 2017
KEYWORD
nonn,base,easy
AUTHOR
Jaroslav Krizek, Aug 02 2009
STATUS
approved
Partial sums of A020988.
+20
2
0, 2, 12, 54, 224, 906, 3636, 14558, 58248, 233010, 932060, 3728262, 14913072, 59652314, 238609284, 954437166, 3817748696, 15270994818, 61083979308, 244335917270, 977343669120, 3909374676522, 15637498706132, 62549994824574
OFFSET
0,2
LINKS
Hacène Belbachir and El-Mehdi Mehiri, Enumerating moves in the optimal solution of the Tower of Hanoi, arXiv:2210.08657 [math.CO], 2022.
FORMULA
a(n) = Sum_{i=0..n} A020988(i). a(n+1)-a(n)=A020988(n+1).
a(n) = 2*(4^(n+1)-3n-4)/9 = 2*A014825(n). - R. J. Mathar, Oct 21 2008
G.f.: 2*x/((1-x)^2*(1-4*x)). [Colin Barker, Jan 11 2012]
a(n) = 6*a(n-1)-9*a(n-2)+4*a(n-3), for n>2, with {a(k)}={0,2,12}, k=0,1,2. - L. Edson Jeffery, Mar 01 2012
MATHEMATICA
lst={}; s=0; Do[s+=(s+=n+s); AppendTo[lst, s], {n, 0, 5!}]; lst
Accumulate[LinearRecurrence[{5, -4}, {0, 2}, 30]] (* or *) LinearRecurrence[ {6, -9, 4}, {0, 2, 12}, 30] (* Harvey P. Dale, Sep 25 2013 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
Edited by R. J. Mathar, Oct 21 2008
STATUS
approved
Duplicate of A020988.
+20
0
0, 2, 10, 42, 170, 682, 2730, 10922, 43690, 174762, 699050, 2796202, 11184810
OFFSET
0,2
KEYWORD
dead
STATUS
approved
Remove all factors of 2 from n; or largest odd divisor of n; or odd part of n.
(Formerly M2222 N0881)
+10
703
1, 1, 3, 1, 5, 3, 7, 1, 9, 5, 11, 3, 13, 7, 15, 1, 17, 9, 19, 5, 21, 11, 23, 3, 25, 13, 27, 7, 29, 15, 31, 1, 33, 17, 35, 9, 37, 19, 39, 5, 41, 21, 43, 11, 45, 23, 47, 3, 49, 25, 51, 13, 53, 27, 55, 7, 57, 29, 59, 15, 61, 31, 63, 1, 65, 33, 67, 17, 69, 35, 71, 9, 73, 37, 75, 19, 77
OFFSET
1,3
COMMENTS
When n > 0 is written as k*2^j with k odd then k = A000265(n) and j = A007814(n), so: when n is written as k*2^j - 1 with k odd then k = A000265(n+1) and j = A007814(n+1), when n > 1 is written as k*2^j + 1 with k odd then k = A000265(n-1) and j = A007814(n-1).
Also denominator of 2^n/n (numerator is A075101(n)). - Reinhard Zumkeller, Sep 01 2002
Slope of line connecting (o, a(o)) where o = (2^k)(n-1) + 1 is 2^k and (by design) starts at (1, 1). - Josh Locker (joshlocker(AT)macfora.com), Apr 17 2004
Numerator of n/2^(n-1). - Alexander Adamchuk, Feb 11 2005
From Marco Matosic, Jun 29 2005: (Start)
"The sequence can be arranged in a table:
1
1 3 1
1 5 3 7 1
1 9 5 11 3 13 7 15 1
1 17 9 19 5 21 11 23 3 25 13 27 7 29 15 31 1
Every new row is the previous row interspaced with the continuation of the odd numbers.
Except for the ones; the terms (t) in each column are t+t+/-s = t_+1. Starting from the center column of threes and working to the left the values of s are given by A000265 and working to the right by A000265." (End)
This is a fractal sequence. The odd-numbered elements give the odd natural numbers. If these elements are removed, the original sequence is recovered. - Kerry Mitchell, Dec 07 2005
2k + 1 is the k-th and largest of the subsequence of k terms separating two successive equal entries in a(n). - Lekraj Beedassy, Dec 30 2005
It's not difficult to show that the sum of the first 2^n terms is (4^n + 2)/3. - Nick Hobson, Jan 14 2005
In the table, for each row, (sum of terms between 3 and 1) - (sum of terms between 1 and 3) = A020988. - Eric Desbiaux, May 27 2009
This sequence appears in the analysis of A160469 and A156769, which resemble the numerator and denominator of the Taylor series for tan(x). - Johannes W. Meijer, May 24 2009
Indices n such that a(n) divides 2^n - 1 are listed in A068563. - Max Alekseyev, Aug 25 2013
From Alexander R. Povolotsky, Dec 17 2014: (Start)
With regard to the tabular presentation described in the comment by Marco Matosic: in his drawing, starting with the 3rd row, the first term in the row, which is equal to 1 (or, alternatively the last term in the row, which is also equal to 1), is not in the actual sequence and is added to the drawing as a fictitious term (for the sake of symmetry); an actual A000265(n) could be considered to be a(j,k) (where j >= 1 is the row number and k>=1 is the column subscript), such that a(j,1) = 1:
1
1 3
1 5 3 7
1 9 5 11 3 13 7 15
1 17 9 19 5 21 11 23 3 25 13 27 7 29 15 31
and so on ... .
The relationship between k and j for each row is 1 <= k <= 2^(j-1). In this corrected tabular representation, Marco's notion that "every new row is the previous row interspaced with the continuation of the odd numbers" remains true. (End)
Partitions natural numbers to the same equivalence classes as A064989. That is, for all i, j: a(i) = a(j) <=> A064989(i) = A064989(j). There are dozens of other such sequences (like A003602) for which this also holds: In general, all sequences for which a(2n) = a(n) and the odd bisection is injective. - Antti Karttunen, Apr 15 2017
From Paul Curtz, Feb 19 2019: (Start)
This sequence is the truncated triangle:
1, 1;
3, 1, 5;
3, 7, 1, 9;
5, 11, 3, 13, 7;
15, 1, 17, 9, 19, 5;
21, 11, 23, 3, 25, 13, 27;
7, 29, 15, 31, 1, 33, 17, 35;
...
The first column is A069834. The second column is A213671. The main diagonal is A236999. The first upper diagonal is A125650 without 0.
c(n) = ((n*(n+1)/2))/A069834 = 1, 1, 2, 2, 1, 1, 4, 4, 1, 1, 2, 2, 1, 1, 8, 8, 1, 1, ... for n > 0. n*(n+1)/2 is the rank of A069834. (End)
As well as being multiplicative, a(n) is a strong divisibility sequence, that is, gcd(a(n),a(m)) = a(gcd(n,m)) for n, m >= 1. In particular, a(n) is a divisibility sequence: if n divides m then a(n) divides a(m). - Peter Bala, Feb 27 2019
a(n) is also the map n -> A026741(n) applied at least A007814(n) times. - Federico Provvedi, Dec 14 2021
REFERENCES
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).
LINKS
Daniel Forgues, Table of n, a(n) for n = 1..100000 (first 10000 terms from T. D. Noe)
V. Daiev and J. L. Brown, Problem H-81, Fib. Quart., 6 (1968), 52.
Eric Weisstein's World of Mathematics, Odd Part
Eric Weisstein's World of Mathematics, Trigonometry Angles
Eric Weisstein's World of Mathematics, Sphere Line Picking
FORMULA
a(n) = if n is odd then n, otherwise a(n/2). - Reinhard Zumkeller, Sep 01 2002
a(n) = n/A006519(n) = 2*A025480(n-1) + 1.
Multiplicative with a(p^e) = 1 if p = 2, p^e if p > 2. - David W. Wilson, Aug 01 2001
a(n) = Sum_{d divides n and d is odd} phi(d). - Vladeta Jovovic, Dec 04 2002
G.f.: -x/(1 - x) + Sum_{k>=0} (2*x^(2^k)/(1 - 2*x^(2^(k+1)) + x^(2^(k+2)))). - Ralf Stephan, Sep 05 2003
(a(k), a(2k), a(3k), ...) = a(k)*(a(1), a(2), a(3), ...) In general, a(n*m) = a(n)*a(m). - Josh Locker (jlocker(AT)mail.rochester.edu), Oct 04 2005
a(n) = Sum_{k=0..n} A127793(n,k)*floor((k+2)/2) (conjecture). - Paul Barry, Jan 29 2007
Dirichlet g.f.: zeta(s-1)*(2^s - 2)/(2^s - 1). - Ralf Stephan, Jun 18 2007
a(A132739(n)) = A132739(a(n)) = A132740(n). - Reinhard Zumkeller, Aug 27 2007
a(n) = 2*A003602(n) - 1. - Franklin T. Adams-Watters, Jul 02 2009
a(n) = n/gcd(2^n,n). (This also shows that the true offset is 0 and a(0) = 0.) - Peter Luschny, Nov 14 2009
a(-n) = -a(n) for all n in Z. - Michael Somos, Sep 19 2011
From Reinhard Zumkeller, May 01 2012: (Start)
A182469(n, k) = A027750(a(n), k), k = 1..A001227(n).
a(n) = A182469(n, A001227(n)). (End)
a((2*n-1)*2^p) = 2*n - 1, p >= 0 and n >= 1. - Johannes W. Meijer, Feb 05 2013
G.f.: G(0)/(1 - 2*x^2 + x^4) - 1/(1 - x), where G(k) = 1 + 1/(1 - x^(2^k)*(1 - 2*x^(2^(k+1)) + x^(2^(k+2)))/(x^(2^k)*(1 - 2*x^(2^(k+1)) + x^(2^(k+2))) + (1 - 2*x^(2^(k+2)) + x^(2^(k+3)))/G(k+1))); (continued fraction). - Sergei N. Gladkovskii, Aug 06 2013
a(n) = A003961(A064989(n)). - Antti Karttunen, Apr 15 2017
Completely multiplicative with a(2) = 1 and a(p) = p for prime p > 2, i.e., the sequence b(n) = a(n) * A008683(n) for n > 0 is the Dirichlet inverse of a(n). - Werner Schulte, Jul 08 2018
From Peter Bala, Feb 27 2019: (Start)
O.g.f.: F(x) - F(x^2) - F(x^4) - F(x^8) - ..., where F(x) = x/(1 - x)^2 is the generating function for the positive integers.
O.g.f. for reciprocals: Sum_{n >= 1} x^n/a(n) = L(x) + (1/2)*L(x^2) + (1/2)*L(x^4) + (1/2)*L(x^8) + ..., where L(x) = log(1/(1 - x)).
Sum_{n >= 1} x^n/a(n) = 1/2*log(G(x)), where G(x) = 1 + 2*x + 4*x^2 + 6*x^3 + 10*x^4 + ... is the o.g.f. of A000123. (End)
O.g.f.: Sum_{n >= 1} phi(2*n-1)*x^(2*n-1)/(1 - x^(2*n-1)), where phi(n) is the Euler totient function A000010. - Peter Bala, Mar 22 2019
a(n) = n - (1/2)*Sum_{d|2n} (-1)^d*phi(d). - Ridouane Oudra, May 01 2019
a(n) = A049606(n) / A049606(n-1). - Flávio V. Fernandes, Dec 08 2020
a(n) = numerator of n/2^(floor(n/2)). - Federico Provvedi, Dec 14 2021
a(n) = Sum_{d divides n} (-1)^(d+1)*phi(2*n/d). - Peter Bala, Jan 14 2024
a(n) = A030101(A030101(n)). - Darío Clavijo, Sep 19 2024
EXAMPLE
G.f. = x + x^2 + 3*x^3 + x^4 + 5*x^5 + 3*x^6 + 7*x^7 + x^8 + 9*x^9 + 5*x^10 + 11*x^11 + ...
MAPLE
A000265:=proc(n) local t1, d; t1:=1; for d from 1 by 2 to n do if n mod d = 0 then t1:=d; fi; od; t1; end: seq(A000265(n), n=1..77);
A000265 := n -> n/2^padic[ordp](n, 2): seq(A000265(n), n=1..77); # Peter Luschny, Nov 26 2010
MATHEMATICA
a[n_Integer /; n > 0] := n/2^IntegerExponent[n, 2]; Array[a, 77] (* Josh Locker *)
a[ n_] := If[ n == 0, 0, n / 2^IntegerExponent[ n, 2]]; (* Michael Somos, Dec 17 2014 *)
PROG
(PARI)
{a(n) = n >> valuation(n, 2)}; /* Michael Somos, Aug 09 2006, edited by M. F. Hasler, Dec 18 2014 */
(Haskell)
a000265 = until odd (`div` 2)
-- Reinhard Zumkeller, Jan 08 2013, Apr 08 2011, Oct 14 2010
(Scheme) (define (A000265 n) (let loop ((n n)) (if (odd? n) n (loop (/ n 2))))) ;; Antti Karttunen, Apr 15 2017
(Python)
from __future__ import division
def A000265(n):
while not n % 2:
n //= 2
return n # Chai Wah Wu, Mar 25 2018
(Java)
int A000265(n){
while(n%2==0) n>>=1;
return n;
}
/* Aidan Simmons, Feb 24 2019 */
(Julia)
using IntegerSequences
[OddPart(n) for n in 1:77] |> println # Peter Luschny, Sep 25 2021
(Magma)
A000265:= func< n | n/2^Valuation(n, 2) >;
[A000265(n): n in [1..120]]; // G. C. Greubel, Jul 31 2024
(SageMath)
def A000265(n): return n//2^valuation(n, 2)
[A000265(n) for n in (1..121)] # G. C. Greubel, Jul 31 2024
CROSSREFS
Cf. A049606 (partial products), A135013 (partial sums), A099545 (mod 4), A326937 (Dirichlet inverse).
Cf. A026741 (map), A001511 (converging steps), A038550 (prime index).
Cf. A195056 (Dgf at s=3).
KEYWORD
mult,nonn,easy,nice
EXTENSIONS
Additional comments from Henry Bottomley, Mar 02 2000
More terms from Larry Reeves (larryr(AT)acm.org), Mar 14 2000
Name clarified by David A. Corneth, Apr 15 2017
STATUS
approved
List of totally balanced sequences of 2n binary digits written in base 10. Binary expansion of each term contains n 0's and n 1's and reading from left to right (the most significant to the least significant bit), the number of 0's never exceeds the number of 1's.
+10
379
0, 2, 10, 12, 42, 44, 50, 52, 56, 170, 172, 178, 180, 184, 202, 204, 210, 212, 216, 226, 228, 232, 240, 682, 684, 690, 692, 696, 714, 716, 722, 724, 728, 738, 740, 744, 752, 810, 812, 818, 820, 824, 842, 844, 850, 852, 856, 866, 868, 872, 880, 906, 908, 914
OFFSET
0,2
COMMENTS
The binary Dyck-Language (A063171) in decimal representation.
These encode width 2n mountain ranges, rooted planar trees of n+1 vertices and n edges, planar planted trees with n nodes, rooted plane binary trees with n+1 leaves (2n edges, 2n+1 vertices, n internal nodes, the root included), Dyck words, binary bracketings, parenthesizations, non-crossing handshakes and partitions and many other combinatorial structures in Catalan family, enumerated by A000108.
Is Sum_{k=1..n} a(k) / n^(5/2) bounded? - Benoit Cloitre, Aug 18 2002
This list is the intersection of A061854 and A031443. - Jason Kimberley, Jan 18 2013
The sequence does start at n = 0, since in the binary interpretation of the Dyck language (e.g., as parenthesizations where "1" stands for "(" and "0" stands for ")") having a(0) = 0 will do since it would stand for the empty string where the "0"s and "1"s are balanced (hence the parentheses are balanced). - Daniel Forgues, Feb 17 2013
It appears that for n>=1 this sequence can be obtained by concatenating the terms of the irregular array whose n-th row length is A000108(n) and that is defined recursively by B(n,0) = A020988(n) and B(n,k) = B(n, k-1) + D(n, k-1) where D(x,y) = (2^(2*(A089309(B(x,y))-1))-1)*(2/3) + 2^A007814(B(x,y)). - Raúl Mario Torres Silva and Michel Marcus, May 01 2020
This encoding is related to the ranking by standard ordered tree numbers in that (1) the binary encoding of trees ordered by standard ranking is given by A358505, while (2) the standard ranking of trees ordered by binary encoding is given by A358523. - Gus Wiseman, Nov 21 2022
REFERENCES
Donald E. Knuth, The Art of Computer Programming, Vol. 4A: Combinatorial Algorithms, Part 1, Addison-Wesley, 2011, Section 7.2.1.6, pp. 443 (Algorithm P).
LINKS
Paolo Xausa, Table of n, a(n) for n = 0..23713 (terms 0..2500 from Franklin T. Adams-Watters).
Jason Bell, Thomas Finn Lidbetter, and Jeffrey Shallit, Additive Number Theory via Approximation by Regular Languages, arXiv:1804.07996 [cs.FL], 2018.
N. G. De Bruijn and B. J. M. Morselt, A note on plane trees, J. Combinatorial Theory 2 (1967), 27-34.
Gennady Eremin, Dynamics of balanced parentheses, lexicographic series and Dyck polynomials, arXiv:1909.07675 [math.CO], 2019.
R. K. Guy, The Second Strong Law of Small Numbers, Math. Mag, 63 (1990), no. 1, 3-20.
Antti Karttunen, Catalan ranking and unranking functions, OEIS Wiki.
Dana G. Korssjoen, Biyao Li, Stefan Steinerberger, Raghavendra Tripathi, and Ruimin Zhang, Finding structure in sequences of real numbers via graph theory: a problem list, arXiv:2012.04625 [math.CO], 2020-2021.
D. L. Kreher and D. R. Stinson, Combinatorial Algorithms, Generation, Enumeration and Search, CRC Press, 1998.
Thomas Finn Lidbetter, Counting, Adding, and Regular Languages, Master's Thesis, University of Waterloo, Ontario, Canada, 2018.
R. J. Mathar, Topologically Distinct Sets of Non-intersecting Circles in the Plane, arXiv:1603.00077 [math.CO], 2016.
R. P. Stanley, Hipparchus, Plutarch, Schroeder and Hough, Am. Math. Monthly, Vol. 104, No. 4, p. 344, 1997.
Index entries for encodings of plane rooted trees (various subsets of this sequence).
Index entries for signature-permutations induced by Catalan automorphisms (permutations of natural numbers induced by various bijective operations acting on these structures)
Index entries for the sequences induced by list functions of Lisp (sequences induced by various other operations on these codes or the corresponding structures).
EXAMPLE
a(19) = 226_10 = 11100010_2 = A063171(19) as bracket expression: ( ( ( ) ) )( ) and as a binary tree, proceeding from left to right in depth-first fashion, with 1's in binary expansion standing for internal (branching) nodes and 0's for leaves:
0 0
\ /
1 0 0 (0)
\ / \ /
1 1
\ /
1
Note that in this coding scheme the last leaf of the binary trees (here in parentheses) is implicit. This tree can be also converted to a particular S-expression in languages like Lisp, Scheme and Prolog, if we interpret its internal nodes (1's) as cons cells with each leftward leaning branch being the "car" and the rightward leaning branch the "cdr" part of the pair, with the terminal nodes (0's) being ()'s (NILs). Thus we have (cons (cons (cons () ()) ()) (cons () ())) = '( ( ( () . () ) . () ) . ( () . () ) ) = (((())) ()) i.e., the same bracket expression as above, but surrounded by extra parentheses. This mapping is performed by the Scheme function A014486->parenthesization given below.
From Gus Wiseman, Nov 21 2022: (Start)
The terms and corresponding ordered rooted trees begin:
0: o
2: (o)
10: (oo)
12: ((o))
42: (ooo)
44: (o(o))
50: ((o)o)
52: ((oo))
56: (((o)))
170: (oooo)
172: (oo(o))
178: (o(o)o)
180: (o(oo))
184: (o((o)))
(End)
MAPLE
# Maple procedure CatalanUnrank is adapted from the algorithm 3.24 of the CAGES book and the Scheme function CatalanUnrank from Ruskey's thesis. See the a089408.c program for the corresponding C procedures.
CatalanSequences := proc(upto_n) local n, a, r; a := []; for n from 0 to upto_n do for r from 0 to (binomial(2*n, n)/(n+1))-1 do a := [op(a), CatalanUnrank(n, r)]; od; od; return a; end;
CatalanUnrank := proc(n, rr) local r, x, y, lo, m, a; r := (binomial(2*n, n)/(n+1))-(rr+1); y := 0; lo := 0; a := 0; for x from 1 to 2*n do m := Mn(n, x, y+1); if(r <= lo+m-1) then y := y+1; a := 2*a + 1; else lo := lo+m; y := y-1; a := 2*a; fi; od; return a; end;
Mn := (n, x, y) -> binomial(2*n-x, n-((x+y)/2)) - binomial(2*n-x, n-1-((x+y)/2));
# Alternative:
bin := n -> ListTools:-Reverse(convert(n, base, 2)):
isA014486 := proc(n): local B, s, b; s := 0;
if n > 0 then
for b in bin(n) do
s := s + ifelse(b = 1, 1, -1);
if 0 > s then return false fi;
od fi;
s = 0 end:
select(isA014486, [seq(0..240)]); # Peter Luschny, Mar 13 2024
MATHEMATICA
cat[ n_ ] := (2 n)!/n!/(n+1)!; b2d[li_List] := Fold[2#1+#2&, 0, li]
d2b[n_Integer] := IntegerDigits[n, 2]
tree[n_] := Join[Table[1, {i, 1, n}], Table[0, {i, 1, n}]]
nexttree[t_] := Flatten[Reverse[t]/. {a___, 0, 0, 1, b___}:> Reverse[{Sort[{a, 0}]//Reverse, 1, 0, b}]]
wood[ n_ /; n<8 ] := NestList[ nexttree, tree[ n ], cat[ n ]-1 ]
Table[ Reverse[ b2d/@wood[ j ] ], {j, 0, 6} ]//Flatten
tbQ[n_]:=Module[{idn2=IntegerDigits[n, 2]}, Count[idn2, 1]==Length[idn2]/2&&Min[Accumulate[idn2/.{0->-1}]]>=0]; Join[{0}, Select[Range[900], tbQ]] (* Harvey P. Dale, Jul 04 2013 *)
balancedQ[0] = True; balancedQ[n_] := Module[{s = 0}, Do[s += If[b == 1, 1, -1]; If[s < 0, Return[False]], {b, IntegerDigits[n, 2]}]; Return[s == 0] ]; A014486 = FromDigits /@ IntegerDigits[Select[Range[0, 1000], balancedQ ]] (* Jean-François Alcover, Mar 05 2016 *)
A014486Q[0] = True; A014486Q[n_] := Catch[Fold[If[# < 0, Throw[False], If[#2 == 0, # - 1, # + 1]] &, 0, IntegerDigits[n, 2]] == 0]; Select[Range[0, 880], A014486Q] (* JungHwan Min, Dec 11 2016 *)
(* Uses Algorithm P from Knuth's TAOCP section 7.2.1.6 - see References and Links. *)
alist[n_] := Block[{a = Flatten[Table[{1, 0}, n]], m = 2*n - 1, j, k},
FromDigits[#, 2]& /@ Reap[
While[True,
Sow[a]; a[[m]] = 0;
If[a[[m - 1]] == 0,
a[[--m]] = 1, j = m - 1; k = 2*n - 1;
While[j > 1 && a[[j]] == 1, a[[j--]] = 0; a[[k]] = 1; k -= 2];
If[j == 1, Break[]];
a[[j]] = 1; m = 2*n - 1]
]][[2, 1]]];
Join[{{0}, {2}}, Array[alist, 4, 2]] (* Paolo Xausa, Mar 16 2024 *)
PROG
(MIT/GNU Scheme) (define (A014486 n) (let ((w/2 (A072643 n))) (CatalanUnrank w/2 (if (zero? n) 0 (- n (A014137 (-1+ w/2)))))))
;;; Here 'm' is the row on A009766 and 'y' is the position on row 'm' of A009766, both >= 0. The resulting totally balanced binary string is computed into variable 'a':
(define (CatalanUnrank size rank) (let loop ((a 0) (m (-1+ size)) (y size) (rank rank) (c (A009766 (-1+ size) size))) (if (negative? m) a (if (>= rank c) (loop (1+ (* 2 a)) m (-1+ y) (- rank c) (A009766 m (-1+ y))) (loop (* 2 a) (-1+ m) y rank (A009766 (-1+ m) y))))))
;;; This converts the totally balanced binary string 'n' into the corresponding S-expression:
(define (A014486->parenthesization n) (let loop ((n n) (stack (list (list)))) (cond ((zero? n) (car stack)) ((zero? (modulo n 2)) (loop (floor->exact (/ n 2)) (cons (list) stack))) (else (loop (floor->exact (/ n 2)) (cons2top! stack))))))
(define (cons2top! stack) (let ((ex-cdr (cdr stack))) (set-cdr! stack (car ex-cdr)) (set-car! ex-cdr stack) ex-cdr))
(PARI) isA014486(n)=my(v=binary(n), t=0); for(i=1, #v, t+=if(v[i], 1, -1); if(t<0, return(0))); t==0 \\ Charles R Greathouse IV, Jun 10 2011
(PARI) a_rows(N) = my(a=Vec([[0]], N)); for(r=1, N-1, my(b=a[r], c=List()); foreach(b, t, my(v=if(t, valuation(t, 2), 0)); for(i=0, v, listput(~c, (t<<2)+(2<<i)))); a[r+1]=Vec(c)); a; \\ Ruud H.G. van Tol, May 16 2024
(SageMath)
def is_A014486(n) :
B = bin(n)[2::] if n != 0 else 0
s = 0
for b in B :
s += 1 if b=='1' else -1
if 0 > s : return False
return 0 == s
def A014486_list(n): return [k for k in (1..n) if is_A014486(k) ]
A014486_list(888) # Peter Luschny, Aug 10 2012
(Python)
from itertools import count, islice
from sympy.utilities.iterables import multiset_permutations
def A014486_gen(): # generator of terms
yield 0
for l in count(1):
for s in multiset_permutations('0'*l+'1'*(l-1)):
c, m = 0, (l<<1)-1
for i in range(m):
if s[i] == '1':
c += 2
if c<i:
break
else:
yield (1<<m)+int(''.join(s), 2)
A014486_list = list(islice(A014486_gen(), 30)) # Chai Wah Wu, Nov 28 2023
CROSSREFS
Characteristic function: A080116. Inverse function: A080300.
The terms of binary width 2n are counted by A000108(n). Subset of A036990. Number of peaks in each mountain (number of leaves in rooted plane general trees): A057514. Number of trailing zeros in the binary expansion: A080237. First differences: A085192.
Branches of the ordered tree are counted by A057515.
Edges of the ordered tree are counted by A072643.
The Matula-Goebel number of the ordered tree is A127301.
The standard ranking of the ordered tree is A358523.
The depth of the ordered tree is A358550.
Nodes of the ordered tree are counted by A358551.
KEYWORD
nonn,nice,easy,base
EXTENSIONS
Additional comments from Antti Karttunen, Aug 11 2000 and May 25 2004
Added a(0)=0 (which had been removed in June 2011), Joerg Arndt, Feb 27 2013
STATUS
approved
a(2n) = 2*a(2n-1), a(2n+1) = 2*a(2n)+1 (also a(n) is the n-th number without consecutive equal binary digits).
+10
296
0, 1, 2, 5, 10, 21, 42, 85, 170, 341, 682, 1365, 2730, 5461, 10922, 21845, 43690, 87381, 174762, 349525, 699050, 1398101, 2796202, 5592405, 11184810, 22369621, 44739242, 89478485, 178956970, 357913941, 715827882, 1431655765, 2863311530, 5726623061, 11453246122
OFFSET
0,3
COMMENTS
Might be called the "Lichtenberg sequence" after Georg Christoph Lichtenberg, who discussed it in 1769 in connection with the Chinese Rings puzzle (baguenaudier). - Andreas M. Hinz, Feb 15 2017
Number of steps to change from a binary string of n 0's to n 1's using a Gray code. - Jon Stadler (jstadler(AT)coastal.edu)
Popular puzzles such as Spin-Out and The Brain Puzzler are based on the Gray binary system and require a(n) steps to complete for some number n.
Conjecture: {a(n)} also gives all j for which A048702(j) = A000217(j); i.e., if we take the a(n)-th triangular number (a(n)^2 + a(n))/2 and multiply it by 3, we get a(n)-th even-length binary palindrome A048701(a(n)) concatenated from a(n) and its reverse. E.g., a(4) = 10, which is 1010 in binary; the tenth triangular number is 55, and 55*3 = 165 = 10100101 in binary. - Antti Karttunen, circa 1999. (This has been now proved by Paul K. Stockmeyer in his arXiv:1608.08245 paper.) - Antti Karttunen, Aug 31 2016
Number of ways to tie a tie of n or fewer half turns, excluding mirror images. Also number of walks of length n or less on a triangular lattice with the following restrictions; given l, r and c as the lattice axes. 1. All steps are taken in the positive axis direction. 2. No two consecutive steps are taken on the same axis. 3. All walks begin with l. 4. All walks end with rlc or lrc. - Bill Blewett, Dec 21 2000
a(n) is the minimal number of vertices to be selected in a vertex-cover of the balanced tree B_n. - Sen-peng Eu, Jun 15 2002
A087117(a(n)) = A038374(a(n)) = 1 for n > 1; see also A090050. - Reinhard Zumkeller, Nov 20 2003
Intersection of A003754 and A003714; complement of A107907. - Reinhard Zumkeller, May 28 2005
Equivalently, numbers m whose binary representation is effectively, for some number k, both the lazy Fibonacci and the Zeckendorf representation of k (in which case k = A022290(m)). - Peter Munn, Oct 06 2022
a(n+1) gives row sums of Riordan array (1/(1-x), x(1+2x)). - Paul Barry, Jul 18 2005
Total number of initial 01's in all binary words of length n+1. Example: a(3) = 5 because the binary words of length 4 that start with 01 are (01)00, (01)(01), (01)10 and (01)11 and the total number of initial 01's is 5 (shown between parentheses). a(n) = Sum_{k >= 0} k*A119440(n+1, k). - Emeric Deutsch, May 19 2006
In Norway we call the 10-ring puzzle "strikketoy" or "knitwear" (see link). It takes 682 moves to free the two parts. - Hans Isdahl, Jan 07 2008
Equals A002450 and A020988 interlaced. - Zak Seidov, Feb 10 2008
For n > 1, let B_n = the complete binary tree with vertex set V where |V| = 2^n - 1. If VC is a minimum-size vertex cover of B_n, Sen-Peng Eu points out that a(n) = |VC|. It also follows that if IS = V\VC, a(n+1) = |IS|. - K.V.Iyer, Apr 13 2009
Starting with 1 and convolved with [1, 2, 2, 2, ...] = A000295. - Gary W. Adamson, Jun 02 2009
a(n) written in base 2 is sequence A056830(n). - Jaroslav Krizek, Aug 05 2009
This is the sequence A(0, 1; 1, 2; 1) of the family of sequences [a,b:c,d:k] considered by G. Detlefs, and treated as A(a,b;c,d;k) in the W. Lang link given below. - Wolfdieter Lang, Oct 18 2010
From Vladimir Shevelev, Jan 30 2012, Feb 13 2012: (Start)
1) Denote by {n, k} the number of permutations of 1, ..., n with the up-down index k (for definition, see comment in A203827). Then max_k{n, k} = {n, a(n)} = A000111(n).
2) a(n) is the minimal number > a(n-1) with the Hamming distance d_H(a(n-1), a(n)) = n. Thus this sequence is the Hamming analog of triangular numbers 0, 1, 3, 6, 10, ... (End)
From Hieronymus Fischer, Nov 22 2012: (Start)
Represented in binary form each term after the second one contains every previous term as a substring.
The terms a(2) = 2 and a(3) = 5 are the only primes. Proof: For even n we get a(n) = 2*(2^(2*n) - 1)/3, which shows that a(n) is even, too, and obviously a(n) > 2 for all even n > 2. For odd n we have a(n) = (2^(n+1) - 1)/3 = (2^((n+1)/2) - 1) * (2^((n+1)/2) + 1)/3. Evidently, at least one of these factors is divisible by 3, both are greater than 6, provided n > 3. Hence it follows that a(n) is composite for all odd n > 3.
Represented as a binary number, a(n+1) has exactly n prime substrings. Proof: Evidently, a(1) = 1_2 has zero and a(2) = 10_2 has 1 prime substring. Let n > 1. Written in binary, a(n+1) is 101010101...01 (if n + 1 is odd) and is 101010101...10 (if n + 1 is even) with n + 1 digits. Only the 2- and 3-digits substrings 10_2 (=2) and 101_2 (=5) are prime substrings. All the other substrings are nonprime since every substring is a previous term and all terms unequal to 2 and 5 are nonprime. For even n + 1, the number of prime substrings equal to 2 = 10_2 is (n+1)/2, and the number of prime substrings equal to 5 = 101_2 is (n-1)/2, makes a sum of n. For odd n + 1 we get n/2 for both, the number of 2's and 5's prime substrings, in any case, the sum is n.
(End)
Also the number of different 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, Feb 09 2013
A090079(a(n)) = a(n) and A090079(m) <> a(n) for m < a(n). - Reinhard Zumkeller, Feb 16 2013
a(n) is the number of length n binary words containing at least one 1 and ending in an even number (possibly zero) of 0's. a(3) = 5 because we have: 001, 011, 100, 101, 111. - Geoffrey Critzer, Dec 15 2013
a(n) is the number of permutations of length n+1 having exactly one descent such that the first element of the permutation is an even number. - Ran Pan, Apr 18 2015
a(n) is the sequence of the last row of the Hadamard matrix H(2^n) obtained via Sylvester's construction: H(2) = [1,1;1,-1], H(2^n) = H(2^(n-1))*H(2), where * is the Kronecker product. - William P. Orrick, Jun 28 2015
Conjectured record values of A264784: a(n) = A264784(A155051(n-1)). - Reinhard Zumkeller, Dec 04 2015. (This is proved by Paul K. Stockmeyer in his arXiv:1608.08245 paper.) - Antti Karttunen, Aug 31 2016
Decimal 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
For n > 4, a(n-2) is the second-largest number in row n of A127824. - Dmitry Kamenetsky, Feb 11 2017
Conjecture: a(n+1) is the number of compositions of n with two kinds of parts, n and n', where the order of the 1 and 1' does not matter. For n=2, a(3) = 5 compositions, enumerated as follows: 2; 2'; 1,1; 1',1 = 1',1; 1',1'. - Gregory L. Simay, Sep 02 2017
Conjecture proved by recognizing the appropriate g.f. is x/(1 - x)(1 - x)(1 - 2*x^2 - 2x^3 - ...) = x/(1 - 2*x - x^2 + 2x^3). - Gregory L. Simay, Sep 10 2017
a(n) = 2^(n-1) + 2^(n-3) + 2^(n-5) + ... a(2*k -1) = A002450(k) is the sum of the powers of 4. a(2*k) = 2*A002450(k). - Gregory L. Simay, Sep 27 2017
a(2*n) = n times the string [10] in binary representation, a(2*n+1) = n times the string [10] followed with [1] in binary representation. Example: a(7) = 85 = (1010101) in binary, a(8) = 170 = (10101010) in binary. - Ctibor O. Zizka, Nov 06 2018
Except for 0, these are the positive integers whose binary expansion has cuts-resistance 1. For the operation of shortening all runs by 1, cuts-resistance is the number of applications required to reach an empty word. Cuts-resistance 2 is A329862. - Gus Wiseman, Nov 27 2019
From Markus Sigg, Sep 14 2020: (Start)
Let s(k) be the length of the Collatz orbit of k, e.g. s(1) = 1, s(2) = 2, s(3) = 5. Then s(a(n)) = n+3 for n >= 3. Proof by induction: s(a(3)) = s(5) = 6 = 3+3. For odd n >= 5 we have s(a(n)) = s(4*a(n-2)+1) = s(12*a(n-2)+4)+1 = s(3*a(n-2)+1)+3 = s(a(n-2))+2 = (n-2)+3+2 = n+3, and for even n >= 4 this gives s(a(n)) = s(2*a(n-1)) = s(a(n-1))+1 = (n-1)+3+1 = n+3.
Conjecture: For n >= 3, a(n) is the second largest natural number whose Collatz orbit has length n+3. (End)
From Gary W. Adamson, May 14 2021: (Start)
With offset 1 the sequence equals the numbers of 1's from n = 1 to 3, 3 to 7, 7 to 15, ...; of A035263; as shown below:
..1 3 7 15...
..1 0 1 1 1 0 1 0 1 0 1 1 1 0 1...
..1.....2...........5......................10...; a(n) = Sum_(k=1..2n-1)A035263(k)
.....1...........2.......................5...; as to zeros.
..1's in the Tower of Hanoi game represent CW moves On disks in the pattern:
..0, 1, 2, 0, 1, 2, ... whereas even numbered disks move in the pattern:
..0, 2, 1, 0, 2, 1, ... (End)
Except for 0, numbers that are repunits in Gray-code representation (A014550). - Amiram Eldar, May 21 2021
From Gus Wiseman, Apr 20 2023: (Start)
Also the number of nonempty subsets of {1..n} with integer median, where the median of a multiset is the middle part in the odd-length case, and the average of the two middle parts in the even-length case. For example, the a(1) = 1 through a(4) = 10 subsets are:
{1} {1} {1} {1}
{2} {2} {2}
{3} {3}
{1,3} {4}
{1,2,3} {1,3}
{2,4}
{1,2,3}
{1,2,4}
{1,3,4}
{2,3,4}
The complement is counted by A005578.
For mean instead of median we have A051293, counting empty sets A327475.
For normal multisets we have A056450, strongly normal A361202.
For partitions we have A325347, strict A359907, complement A307683.
(End)
REFERENCES
Thomas Fink and Yong Mao, The 85 Ways to Tie a Tie, Broadway Books, New York (1999), p. 138.
Clifford A. Pickover, The Math Book, From Pythagoras to the 57th Dimension, 250 Milestones in the History of Mathematics, Sterling Publ., NY, 2009.
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..3300 (terms 0..300 from T. D. Noe)
Thomas Baruchel, Properties of the cumulated deficient binary digit sum, arXiv:1908.02250 [math.NT], 2019.
Sergei L. Bezrukov et al., The congestion of n-cube layout on a rectangular grid, Discrete Mathematics 213.1-3 (2000): 13-19. See Theorem 1.
F. Chapoton and S. Giraudo, Enveloping operads and bicoloured noncrossing configurations, arXiv:1310.4521 [math.CO], 2013. Is the sequence in Table 2 this sequence? - N. J. A. Sloane, Jan 04 2014. (Yes, it is. See Stockmeyer's arXiv:1608.08245 2016 paper for the proof.)
Ji Young Choi, Ternary Modified Collatz Sequences And Jacobsthal Numbers, Journal of Integer Sequences, Vol. 19 (2016), #16.7.5.
Ji Young Choi, A Generalization of Collatz Functions and Jacobsthal Numbers, J. Int. Seq., Vol. 21 (2018), Article 18.5.4.
Madeleine Goertz and Aaron Williams, The Quaternary Gray Code and How It Can Be Used to Solve Ziggurat and Other Ziggu Puzzles, arXiv:2411.19291 [math.CO], 2024. See pp. 1, 17, 42.
David Hayes, Kaveh Khodjasteh, Lorenza Viola and Michael J. Biercuk, Reducing sequencing complexity in dynamical quantum error suppression by Walsh modulation, arXiv:1109.6002 [quant-ph], 2011.
Clemens Heuberger and Daniel Krenn, Esthetic Numbers and Lifting Restrictions on the Analysis of Summatory Functions of Regular Sequences, arXiv:1808.00842 [math.CO], 2018. See p. 10.
Clemens Heuberger and Daniel Krenn, Asymptotic Analysis of Regular Sequences, arXiv:1810.13178 [math.CO], 2018. See p. 29.
Andreas M. Hinz, The Lichtenberg sequence, Fib. Quart., 55 (2017), 2-12.
Andreas M. Hinz, Sandi Klavžar, Uroš Milutinović, and Ciril Petr, The Tower of Hanoi - Myths and Maths, Birkhäuser 2013. See page 56. Book's website
Andreas M. Hinz and Paul K. Stockmeyer, Precious Metal Sequences and Sierpinski-Type Graphs, J. Integer Seq., Vol 25 (2022), Article 22.4.8.
Jia Huang, Norton algebras of the Hamming Graphs via linear characters, arXiv:2101.05711 [math.CO], 2021.
Jia Huang and Erkko Lehtonen, Associative-commutative spectra for some varieties of groupoids, arXiv:2401.15786 [math.CO], 2024. See p. 17.
Jia Huang, Madison Mickey, and Jianbai Xu, The Nonassociativity of the Double Minus Operation, Journal of Integer Sequences, Vol. 20 (2017), #17.10.3.
Hans Isdahl, "Knitwear" puzzle
D. E. Knuth and O. P. Lossers, Partitions of a circular set, Problem 11151 in Amer. Math. Monthly 114 (3) (2007) p 265, E_3.
S. Lafortune, A. Ramani, B. Grammaticos, Y. Ohta and K.M. Tamizhmani, Blending two discrete integrability criteria: singularity confinement and algebraic entropy, arXiv:nlin/0104020 [nlin.SI], 2001.
Robert L. Lamphere, A Recurrence Relation in the Spinout Puzzle, The College Mathematics Journal, Vol. 27, Nbr. 4, Page 289, Sep. 96.
Georg Christoph Lichtenberg, Vermischte Schriften, Band 6 (1805). See chapter 6, p. 257.
Saad Mneimneh, Simple Variations on the Tower of Hanoi to Guide the Study of Recurrences and Proofs by Induction, Department of Computer Science, Hunter College, CUNY, 2019.
Richard Moot, Partial Orders, Residuation, and First-Order Linear Logic, arXiv:2008.06351 [cs.LO], 2020.
Gregg Musiker and Son Nguyen, Labeled Chip-firing on Binary Trees, arXiv:2206.02007 [math.CO], 2022.
Ahmet Öteleş, On the sum of Pell and Jacobsthal numbers by the determinants of Hessenberg matrices, AIP Conference Proceedings 1863, 310003 (2017).
Vladimir Shevelev, On the Basis Polynomials in the Theory of Permutations with Prescribed Up-Down Structure, arXiv:0801.0072 [math.CO], 2007-2010. See Example 3.
Chloe E. Shiff and Noah A. Rosenberg, Enumeration of rooted binary perfect phylogenies, arXiv:2410.14915 [q-bio.PE], 2024. See pp. 15, 17.
A. V. Sills and H. Wang, On the maximal Wiener index and related questions, Discrete Applied Mathematics, Volume 160, Issues 10-11, July 2012, Pages 1615-1623 - N. J. A. Sloane, Sep 21 2012
N. J. A. Sloane, Transforms
Paul K. Stockmeyer, An Exploration of Sequence A000975, arXiv:1608.08245 [math.CO], 2016; Fib. Quart. 55 (2017) 174.
Eric Weisstein's World of Mathematics, Baguenaudier
A. K. Whitford, Binet's Formula Generalized, Fibonacci Quarterly, Vol. 15, No. 1, 1979, pp. 21, 24, 29.
FORMULA
a(n) = ceiling(2*(2^n-1)/3).
Alternating sum transform (PSumSIGN) of {2^n - 1} (A000225).
a(n) = a(n-1) + 2*a(n-2) + 1.
a(n) = 2*2^n/3 - 1/2 - (-1)^n/6.
a(n) = Sum_{i = 0..n} A001045(i), partial sums of A001045. - Bill Blewett
a(n) = n + 2*Sum_{k = 1..n-2} a(k).
G.f.: x/((1+x)*(1-x)*(1-2*x)) = x/(1-2*x-x^2+2*x^3). - Paul Barry, Feb 11 2003
a(n) = 2*a(n-1) + a(n-2) - 2*a(n-3). - Paul Barry, Feb 11 2003
a(n) = Sum_{k = 0..floor((n-1)/2)} 2^(n-2*k-1). - Paul Barry, Nov 11 2003
a(n+1) = Sum_{k=0..floor(n/2)} 2^(n-2*k); a(n+1) = Sum_{k = 0..n} Sum_{j = 0..k} (-1)^(j+k)*2^j. - Paul Barry, Nov 12 2003
(-1)^(n+1)*a(n) = Sum_{i = 0..n} Sum_{k = 1..i} k!*k* Stirling2(i, k)*(-1)^(k-1) = (1/3)*(-2)^(n+1)-(1/6)(3*(-1)^(n+1)-1). - Mario Catalani (mario.catalani(AT)unito.it), Dec 22 2003
a(n+1) = (n!/3)*Sum_{i - (-1)^i + j = n, i = 0..n, j = 0..n} 1/(i - (-1)^i)!/j!. - Benoit Cloitre, May 24 2004
a(n) = A001045(n+1) - A059841(n). - Paul Barry, Jul 22 2004
a(n) = Sum_{k = 0..n} 2^(n-k-1)*(1-(-1)^k), row sums of A130125. - Paul Barry, Jul 28 2004
a(n) = Sum_{k = 0..n} binomial(k, n-k+1)2^(n-k); a(n) = Sum_{k = 0..floor(n/2)} binomial(n-k, k+1)2^k. - Paul Barry, Oct 07 2004
a(n) = A107909(A104161(n)); A007088(a(n)) = A056830(n). - Reinhard Zumkeller, May 28 2005
a(n) = floor(2^(n+1)/3) = ceiling(2^(n+1)/3) - 1 = A005578(n+1) - 1. - Paul Barry, Oct 08 2005
Convolution of "Number of fixed points in all 231-avoiding involutions in S_n." (A059570) with "1-n" (A024000), treating the result as if offset was 0. - Graeme McRae, Jul 12 2006
a(n) = A081254(n) - 2^n. - Philippe Deléham, Oct 15 2006
Starting (1, 2, 5, 10, 21, 42, ...), these are the row sums of triangle A135228. - Gary W. Adamson, Nov 23 2007
Let T = the 3 X 3 matrix [1,1,0; 1,0,1; 0,1,1]. Then T^n * [1,0,0] = [A005578(n), A001045(n), a(n-1)]. - Gary W. Adamson, Dec 25 2007
2^n = 2*A005578(n-1) + 2*A001045(n) + 2*a(n-2). - Gary W. Adamson, Dec 25 2007
If we define f(m,j,x) = Sum_{k=j..m} binomial(m,k)*stirling2(k,j)*x^(m-k) then a(n-3) = (-1)^(n-1)*f(n,3,-2), (n >= 3). - Milan Janjic, Apr 26 2009
a(n) + A001045(n) = A166920(n). a(n) + A001045(n+2) = A051049(n+1). - Paul Curtz, Oct 29 2009
a(n) = floor(A051049(n+1)/3). - Gary Detlefs, Dec 19 2010
a(n) = round((2^(n+2)-3)/6) = floor((2^(n+1)-1)/3) = round((2^(n+1)-2)/3); a(n) = a(n-2) + 2^(n-1), n > 1. - Mircea Merca, Dec 27 2010
a(n) = binary XOR of 2^k-1 for k=0..n. - Paul D. Hanna, Nov 05 2011
E.g.f.: 2/3*exp(2*x) - 1/2*exp(x) - 1/6*exp(-x) = 2/3*U(0); U(k) = 1 - 3/(4*(2^k) - 4*(2^k)/(1+3*(-1)^k - 24*x*(2^k)/(8*x*(2^k)*(-1)^k - (k+1)/U(k+1)))); (continued fraction). - Sergei N. Gladkovskii, Nov 21 2011
Starting with "1" = triangle A059260 * [1, 2, 2, 2, ...] as a vector. - Gary W. Adamson, Mar 06 2012
a(n) = 2*(2^n - 1)/3, for even n; a(n) = (2^(n+1) - 1)/3 = (1/3)*(2^((n+1)/2) - 1)*(2^((n+1)/2) + 1), for odd n. - Hieronymus Fischer, Nov 22 2012
a(n) + a(n+1) = 2^(n+1) - 1. - Arie Bos, Apr 03 2013
G.f.: Q(0)/(3*(1-x)), where Q(k) = 1 - 1/(4^k - 2*x*16^k/(2*x*4^k - 1/(1 + 1/(2*4^k - 8*x*16^k/(4*x*4^k + 1/Q(k+1)))))); (continued fraction). - Sergei N. Gladkovskii, May 21 2013
floor(a(n+2)*3/5) = A077854(n), for n >= 0. - Armands Strazds, Sep 21 2014
a(n) = (2^(n+1) - 2 + (n mod 2))/3. - Paul Toms, Mar 18 2015
a(0) = 0, a(n) = 2*(a(n-1)) + (n mod 2). - Paul Toms, Mar 18 2015
Binary: a(n) = (a(n-1) shift left 1) + (a(n-1)) NOR (...11110). - Paul Toms, Mar 18 2015
Binary: for n > 1, a(n) = 2*a(n-1) OR a(n-2). - Stanislav Sykora, Nov 12 2015
a(n) = A266613(n) - 20*2^(n-5), for n > 2. - Andres Cicuttin, Mar 31 2016
From Michael Somos, Jul 23 2017: (Start)
a(n) = -(2^n)*a(-n) for even n; a(n) = -(2^(n+1))*a(-n) + 1 for odd n.
0 = +a(n)*(+2 +4*a(n) -4*a(n+1)) + a(n+1)*(-1 +a(n+1)) for all n in Z. (End)
G.f.: (x^1+x^3+x^5+x^7+...)/(1-2*x). - Gregory L. Simay, Sep 27 2017
a(n+1) = A051049(n) + A001045(n). - Yuchun Ji, Jul 12 2018
a(n) = A153772(n+3)/4. - Markus Sigg, Sep 14 2020
a(4*k+d) = 2^(d+1)*a(4*k-1) + a(d), a(n+4) = a(n) + 2^n*10, a(0..3) = [0,1,2,5]. So the last digit is always 0,1,2,5 repeated. - Yuchun Ji, May 22 2023
EXAMPLE
a(4)=10 since 0001, 0011, 0010, 0110, 0111, 0101, 0100, 1100, 1101, 1111 are the 10 binary strings switching 0000 to 1111.
a(3) = 1 because "lrc" is the only way to tie a tie with 3 half turns, namely, pass the business end of the tie behind the standing part to the left, bring across the front to the right, then behind to the center. The final motion of tucking the loose end down the front behind the "lr" piece is not considered a "step".
a(4) = 2 because "lrlc" is the only way to tie a tie with 4 half turns. Note that since the number of moves is even, the first step is to go to the left in front of the tie, not behind it. This knot is the standard "four in hand", the most commonly known men's tie knot. By contrast, the second most well known tie knot, the Windsor, is represented by "lcrlcrlc".
a(n) = (2^0 - 1) XOR (2^1 - 1) XOR (2^2 - 1) XOR (2^3 - 1) XOR ... XOR (2^n - 1). - Paul D. Hanna, Nov 05 2011
G.f. = x + 2*x^2 + 5*x^3 + 10*x^4 + 21*x^5 + 42*x^6 + 85*x^7 + 170*x^8 + ...
a(9) = 341 = 2^8 + 2^6 + 2^4 + 2^2 + 2^0 = 4^4 + 4^3 + 4^2 + 4^1 + 4^0 = A002450(5). a(10) = 682 = 2*a(9) = 2*A002450(5). - Gregory L. Simay, Sep 27 2017
MAPLE
A000975 := proc(n) option remember; if n <= 1 then n else if n mod 2 = 0 then 2*A000975(n-1) else 2*A000975(n-1)+1 fi; fi; end;
seq(iquo(2^n, 3), n=1..33); # Zerinvary Lajos, Apr 20 2008
f:=n-> if n mod 2 = 0 then (2^n-1)/3 else (2^n-2)/3; fi; [seq(f(n), n=0..40)]; # N. J. A. Sloane, Mar 21 2017
MATHEMATICA
Array[Ceiling[2(2^# - 1)/3] &, 41, 0]
RecurrenceTable[{a[0] == 0, a[1] == 1, a[n] == a[n - 1] + 2a[n - 2] + 1}, a, {n, 40}] (* or *)
LinearRecurrence[{2, 1, -2}, {0, 1, 2}, 40] (* Harvey P. Dale, Aug 10 2013 *)
f[n_] := Block[{exp = n - 2}, Sum[2^i, {i, exp, 0, -2}]]; Array[f, 33] (* Robert G. Wilson v, Oct 30 2015 *)
f[s_List] := Block[{a = s[[-1]]}, Append[s, If[OddQ@ Length@ s, 2a + 1, 2a]]]; Nest[f, {0}, 32] (* Robert G. Wilson v, Jul 20 2017 *)
NestList[2# + Boole[EvenQ[#]] &, 0, 39] (* Alonso del Arte, Sep 21 2018 *)
PROG
(PARI) {a(n) = if( n<0, 0, 2 * 2^n \ 3)}; /* Michael Somos, Sep 04 2006 */
(PARI) a(n)=if(n<=0, 0, bitxor(a(n-1), 2^n-1)) \\ Paul D. Hanna, Nov 05 2011
(PARI) concat(0, Vec(x/(1-2*x-x^2+2*x^3) + O(x^100))) \\ Altug Alkan, Oct 30 2015
(PARI) {a(n) = (4*2^n - 3 - (-1)^n) / 6}; /* Michael Somos, Jul 23 2017 */
(Haskell)
a000975 n = a000975_list !! n
a000975_list = 0 : 1 : map (+ 1)
(zipWith (+) (tail a000975_list) (map (* 2) a000975_list))
-- Reinhard Zumkeller, Mar 07 2012
(Magma) [(2^(n+1) - 2 + (n mod 2))/3: n in [0..40]]; // Vincenzo Librandi, Mar 18 2015
(GAP) List([0..35], n->(2^(n+1)-2+(n mod 2))/3); # Muniru A Asiru, Nov 01 2018
(Python)
def a(n): return (2**(n+1) - 2 + (n%2))//3
print([a(n) for n in range(35)]) # Michael S. Branicky, Dec 19 2021
CROSSREFS
Partial sums of A001045.
Row sums of triangle A013580.
Equals A026644/2.
Union of the bijections A002450 and A020988. - Robert G. Wilson v, Jun 09 2014
Column k=3 of A261139.
Complement of A107907.
Row 3 of A300653.
Other sequences that relate to the binary representation of the terms: A003714, A003754, A007088, A022290, A056830, A104161, A107909.
KEYWORD
nonn,easy,nice
EXTENSIONS
Additional comments from Barry E. Williams, Jan 10 2000
STATUS
approved
a(n) = (4^n - 1)/3.
(Formerly M3914 N1608)
+10
293
0, 1, 5, 21, 85, 341, 1365, 5461, 21845, 87381, 349525, 1398101, 5592405, 22369621, 89478485, 357913941, 1431655765, 5726623061, 22906492245, 91625968981, 366503875925, 1466015503701, 5864062014805, 23456248059221, 93824992236885, 375299968947541
OFFSET
0,3
COMMENTS
For n > 0, a(n) is the degree (n-1) "numbral" power of 5 (see A048888 for the definition of numbral arithmetic). Example: a(3) = 21, since the numbral square of 5 is 5(*)5 = 101(*)101(base 2) = 101 OR 10100 = 10101(base 2) = 21, where the OR is taken bitwise. - John W. Layman, Dec 18 2001
a(n) is composite for all n > 2 and has factors x, (3*x + 2*(-1)^n) where x belongs to A001045. In binary the terms greater than 0 are 1, 101, 10101, 1010101, etc. - John McNamara, Jan 16 2002
Number of n X 2 binary arrays with path of adjacent 1's from upper left corner to right column. - R. H. Hardin, Mar 16 2002
The Collatz-function iteration started at a(n), for n >= 1, will end at 1 after 2*n+1 steps. - Labos Elemer, Sep 30 2002 [corrected by Wolfdieter Lang, Aug 16 2021]
Second binomial transform of A001045. - Paul Barry, Mar 28 2003
All members of sequence are also generalized octagonal numbers (A001082). - Matthew Vandermast, Apr 10 2003
Also sum of squares of divisors of 2^(n-1): a(n) = A001157(A000079(n-1)), for n > 0. - Paul Barry, Apr 11 2003
Binomial transform of A000244 (with leading zero). - Paul Barry, Apr 11 2003
Number of walks of length 2n between two vertices at distance 2 in the cycle graph C_6. For n = 2 we have for example 5 walks of length 4 from vertex A to C: ABABC, ABCBC, ABCDC, AFABC and AFEDC. - Herbert Kociemba, May 31 2004
Also number of walks of length 2n + 1 between two vertices at distance 3 in the cycle graph C_12. - Herbert Kociemba, Jul 05 2004
a(n+1) is the number of steps that are made when generating all n-step random walks that begin in a given point P on a two-dimensional square lattice. To make one step means to mark one vertex on the lattice (compare A080674). - Pawel P. Mazur (Pawel.Mazur(AT)pwr.wroc.pl), Mar 13 2005
a(n+1) is the sum of square divisors of 4^n. - Paul Barry, Oct 13 2005
a(n+1) is the decimal number generated by the binary bits in the n-th generation of the Rule 250 elementary cellular automaton. - Eric W. Weisstein, Apr 08 2006
a(k) = [M^k]_2,1, where M is the 3 X 3 matrix defined as follows: M = [1, 1, 1; 1, 3, 1; 1, 1, 1]. - Simone Severini, Jun 11 2006
a(n-1) / a(n) = percentage of wasted storage if a single image is stored as a pyramid with a each subsequent higher resolution layer containing four times as many pixels as the previous layer. n is the number of layers. - Victor Brodsky (victorbrodsky(AT)gmail.com), Jun 15 2006
k is in the sequence if and only if C(4k + 1, k) (A052203) is odd. - Paul Barry, Mar 26 2007
This sequence also gives the number of distinct 3-colorings of the odd cycle C(2*n - 1). - Keith Briggs, Jun 19 2007
All numbers of the form m*4^m + (4^m-1)/3 have the property that they are sums of two squares and also their indices are the sum of two squares. This follows from the identity m*4^m + (4^m-1)/3 = 4(4(..4(4m + 1) + 1) + 1) + 1 ..) + 1. - Artur Jasinski, Nov 12 2007
For n > 0, terms are the numbers that, in base 4, are repunits: 1_4, 11_4, 111_4, 1111_4, etc. - Artur Jasinski, Sep 30 2008
Let A be the Hessenberg matrix of order n, defined by: A[1, j] = 1, A[i, i] := 5, (i > 1), A[i, i - 1] = -1, and A[i, j] = 0 otherwise. Then, for n >= 1, a(n) = charpoly(A,1). - Milan Janjic, Jan 27 2010
This is the sequence A(0, 1; 3, 4; 2) = A(0, 1; 4, 0; 1) of the family of sequences [a, b : c, d : k] considered by G. Detlefs, and treated as A(a, b; c, d; k) in the W. Lang link given below. - Wolfdieter Lang, Oct 18 2010
6*a(n) + 1 is every second Mersenne number greater than or equal to M3, hence all Mersenne primes greater than M2 must be a 6*a(n) + 1 of this sequence. - Roderick MacPhee, Nov 01 2010
Smallest number having alternating bit sum n. Cf. A065359.
For n = 1, 2, ..., the last digit of a(n) is 1, 5, 1, 5, ... . - Washington Bomfim, Jan 21 2011
Rule 50 elementary cellular automaton generates this sequence. This sequence also appears in the second column of array in A173588. - Paul Muljadi, Jan 27 2011
Sequence found by reading the line from 0, in the direction 0, 5, ... and the line from 1, in the direction 1, 21, ..., in the square spiral whose edges are the Jacobsthal numbers A001045 and whose vertices are the numbers A000975. These parallel lines are two semi-diagonals in the spiral. - Omar E. Pol, Sep 10 2011
a(n), n >= 1, is also the inverse of 3, denoted by 3^(-1), Modd(2^(2*n - 1)). For Modd n see a comment on A203571. E.g., a(2) = 5, 3 * 5 = 15 == 1 (Modd 8), because floor(15/8) = 1 is odd and -15 == 1 (mod 8). For n = 1 note that 3 * 1 = 3 == 1 (Modd 2) because floor(3/2) = 1 and -3 == 1 (mod 2). The inverse of 3 taken Modd 2^(2*n) coincides with 3^(-1) (mod 2^(2*n)) given in A007583(n), n >= 1. - Wolfdieter Lang, Mar 12 2012
If an AVL tree has a leaf at depth n, then the tree can contain no more than a(n+1) nodes total. - Mike Rosulek, Nov 20 2012
Also, this is the Lucas sequence V(5, 4). - Bruno Berselli, Jan 10 2013
Also, for n > 0, a(n) is an odd number whose Collatz trajectory contains no odd number other than n and 1. - Jayanta Basu, Mar 24 2013
Sum_{n >= 1} 1/a(n) converges to (3*(log(4/3) - QPolyGamma[0, 1, 1/4]))/log(4) = 1.263293058100271... = A321873. - K. G. Stier, Jun 23 2014
Consider n spheres in R^n: the i-th one (i=1, ..., n) has radius r(i) = 2^(1-i) and the coordinates of its center are (0, 0, ..., 0, r(i), 0, ..., 0) where r(i) is in position i. The coordinates of the intersection point in the positive orthant of these spheres are (2/a(n), 4/a(n), 8/a(n), 16/a(n), ...). For example in R^2, circles centered at (1, 0) and (0, 1/2), and with radii 1 and 1/2, meet at (2/5, 4/5). - Jean M. Morales, May 19 2015
From Peter Bala, Oct 11 2015: (Start)
a(n) gives the values of m such that binomial(4*m + 1,m) is odd. Cf. A003714, A048716, A263132.
2*a(n) = A020988(n) gives the values of m such that binomial(4*m + 2, m) is odd.
4*a(n) = A080674(n) gives the values of m such that binomial(4*m + 4, m) is odd. (End)
Collatz Conjecture Corollary: Except for powers of 2, the Collatz iteration of any positive integer must eventually reach a(n) and hence terminate at 1. - Gregory L. Simay, May 09 2016
Number of active (ON, black) cells at stage 2^n - 1 of the two-dimensional cellular automaton defined by "Rule 598", based on the 5-celled von Neumann neighborhood. - Robert Price, May 16 2016
From Luca Mariot and Enrico Formenti, Sep 26 2016: (Start)
a(n) is also the number of coprime pairs of polynomials (f, g) over GF(2) where both f and g have degree n + 1 and nonzero constant term.
a(n) is also the number of pairs of one-dimensional binary cellular automata with linear and bipermutive local rule of neighborhood size n+1 giving rise to orthogonal Latin squares of order 2^m, where m is a multiple of n. (End)
Except for 0, 1 and 5, all terms are Brazilian repunits numbers in base 4, and so belong to A125134. For n >= 3, all these terms are composite because a(n) = {(2^n-1) * (2^n + 1)}/3 and either (2^n - 1) or (2^n + 1) is a multiple of 3. - Bernard Schott, Apr 29 2017
Given the 3 X 3 matrix A = [2, 1, 1; 1, 2, 1; 1, 1, 2] and the 3 X 3 unit matrix I_3, A^n = a(n)(A - I_3) + I_3. - Nicolas Patrois, Jul 05 2017
The binary expansion of a(n) (n >= 1) consists of n 1's alternating with n - 1 0's. Example: a(4) = 85 = 1010101_2. - Emeric Deutsch, Aug 30 2017
a(n) (n >= 1) is the viabin number of the integer partition [n, n - 1, n - 2, ..., 2, 1] (for the definition of viabin number see comment in A290253). Example: a(4) = 85 = 1010101_2; consequently, the southeast border of the Ferrers board of the corresponding integer partition is ENENENEN, where E = (1, 0), N = (0, 1); this leads to the integer partition [4, 3, 2, 1]. - Emeric Deutsch, Aug 30 2017
Numbers whose binary and Gray-code representations are both palindromes (i.e., intersection of A006995 and A281379). - Amiram Eldar, May 17 2021
Starting with n = 1 the sequence satisfies {a(n) mod 6} = repeat{1, 5, 3}. - Wolfdieter Lang, Jan 14 2022
Terms >= 5 are those q for which the multiplicative order of 2 mod q is floor(log_2(q)) + 2 (and which is 1 more than the smallest possible order for any q). - Tim Seuré, Mar 09 2024
The order of 2 modulo a(n) is 2*n for n >= 2. - Joerg Arndt, Mar 09 2024
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).
LINKS
Sung-Hyuk Cha, On Complete and Size Balanced k-ary Tree Integer Sequences, International Journal of Applied Mathematics and Informatics, Issue 2, Volume 6, 2012, pp. 67-75. - From N. J. A. Sloane, Dec 24 2012
Robert Coquereaux and Jean-Bernard Zuber, Counting partitions by genus. II. A compendium of results, arXiv:2305.01100 [math.CO], 2023. See p. 8.
Carlos M. da Fonseca and Anthony G. Shannon, A formal operator involving Fermatian numbers, Notes Num. Theor. Disc. Math. (2024) Vol. 30, No. 3, 491-498.
D. Dumont, Interprétations combinatoires des nombres de Genocchi, Duke Math. J., 41 (1974), 305-318. (Annotated scanned copy)
David Eppstein, Making Change in 2048, arXiv:1804.07396 [cs.DM], 2018.
C. Ernst and D. W. Sumners, The Growth of the Number of Prime Knots, Math. Proc. Cambridge Philos. Soc. 102, 303-315, 1987
Ernesto Estrada and José A. de la Peña, Integer sequences from walks in graphs, Notes on Number Theory and Discrete Mathematics, Vol. 19, 2013, No. 3, 78-84.
Rigoberto Flórez, Robinson A. Higuita, and Antara Mukherjee, Alternating Sums in the Hosoya Polynomial Triangle, Article 14.9.5 Journal of Integer Sequences, Vol. 17 (2014).
Enrico Formenti and Luca Mariot, Exhaustive Generation of Linear Orthogonal CA, Automata 2023, Univ. Twente (Netherlands), see p. 22 of 38.
A. Frosini and S. Rinaldi, On the Sequence A079500 and Its Combinatorial Interpretations, J. Integer Seq., Vol. 9 (2006), Article 06.3.1.
Andreas M. Hinz and Paul K. Stockmeyer, Precious Metal Sequences and Sierpinski-Type Graphs, J. Integer Seq., Vol 25 (2022), Article 22.4.8.
Petro Kosobutskyy and Nataliia Nestor, On the mathematical model of the transformation of natural numbers by a function of a split type, Comp. Des. Sys. Theor. Practice (2024) Vol. 6, No. 2. See p. 7.
Petro Kosobutskyy, Anastasiia Yedyharova, and Taras Slobodzyan, From Newton's binomial and Pascal's triangle to Collatz's problem, Comp. Des. Sys., Theor. Practice (2023) Vol. 5, No. 1, 121-127.
J. V. Leyendekkers and A.G. Shannon, Modular Rings and the Integer 3, Notes on Number Theory & Discrete Mathematics, 17 (2011), 47-51.
Luca Mariot, Orthogonal labelings in de Bruijn graphs, IWOCA 2020 - Open Problems Session, Delft University of Technology (Netherlands).
Luca Mariot, Connections between Latin squares, Cellular Automata and Coprime Polynomials, Univ. Twente (Netherlands, 2023). See p. 16/37.
Luca Mariot, Enrico Formenti and Alberto Leporati, Constructing Orthogonal Latin Squares from Linear Cellular Automata. In: Exploratory papers of AUTOMATA 2016.
Luca Mariot, Maximilien Gadouleau, Enrico Formenti, and Alberto Leporati, Mutually Orthogonal Latin Squares based on Cellular Automata, arXiv:1906.08249 [cs.DM], 2019.
Mircea Merca, A Note on Cosine Power Sums J. Integer Sequences, Vol. 15 (2012), Article 12.5.3.
Simon Plouffe, Approximations de séries génératrices et quelques conjectures, Dissertation, Université du Québec à Montréal, 1992; arXiv:0911.4975 [math.NT], 2009.
Simon Plouffe, 1031 Generating Functions, Appendix to Thesis, Montreal, 1992.
Kalika Prasad, Munesh Kumari, Rabiranjan Mohanta, and Hrishikesh Mahato, The sequence of higher order Mersenne numbers and associated binomial transforms, arXiv:2307.08073 [math.NT], 2023.
A. G. Shannon, Some recurrence relations for binary sequence matrices, NNTDM 17 (2011), 4, 913. - From N. J. A. Sloane, Jun 13 2012
T. N. Thiele, Interpolationsrechnung, Teubner, Leipzig, 1909, p. 35.
Eric Weisstein's World of Mathematics, Repunit, Rule 250, Prime Knot.
Michael Williams, Collatz conjecture: an order isomorphic recursive machine, ResearchGate (2024). See pp. 8, 13.
FORMULA
From Wolfdieter Lang, Apr 24 2001: (Start)
a(n+1) = Sum_{m = 0..n} A060921(n, m).
G.f.: x/((1-x)*(1-4*x)). (End)
a(n) = Sum_{k = 0..n-1} 4^k; a(n) = A001045(2*n). - Paul Barry, Mar 17 2003
E.g.f.: (exp(4*x) - exp(x))/3. - Paul Barry, Mar 28 2003
a(n) = (A007583(n) - 1)/2. - N. J. A. Sloane, May 16 2003
a(n) = A000975(2*n)/2. - N. J. A. Sloane, Sep 13 2003
a(n) = A084160(n)/2. - N. J. A. Sloane, Sep 13 2003
a(n+1) = 4*a(n) + 1, with a(0) = 0. - Philippe Deléham, Feb 25 2004
a(n) = Sum_{i = 0..n-1} C(2*n - 1 - i, i)*2^i. - Mario Catalani (mario.catalani(AT)unito.it), Jul 23 2004
a(n+1) = Sum_{k = 0..n} binomial(n+1, k+1)*3^k. - Paul Barry, Aug 20 2004
a(n) = center term in M^n * [1 0 0], where M is the 3 X 3 matrix [1 1 1 / 1 3 1 / 1 1 1]. M^n * [1 0 0] = [A007583(n-1) a(n) A007583(n-1)]. E.g., a(4) = 85 since M^4 * [1 0 0] = [43 85 43] = [A007583(3) a(4) A007583(3)]. - Gary W. Adamson, Dec 18 2004
a(n) = Sum_{k = 0..n, j = 0..n} C(n, j)*C(j, k)*A001045(j - k). - Paul Barry, Feb 15 2005
a(n) = Sum_{k = 0..n} C(n, k)*A001045(n-k)*2^k = Sum_{k = 0..n} C(n, k)*A001045(k)*2^(n-k). - Paul Barry, Apr 22 2005
a(n) = A125118(n, 3) for n > 2. - Reinhard Zumkeller, Nov 21 2006
a(n) = Sum_{k = 0..n} 2^(n - k)*A128908(n, k), n >= 1. - Philippe Deléham, Oct 19 2008
a(n) = Sum_{k = 0..n} A106566(n, k)*A100335(k). - Philippe Deléham, Oct 30 2008
If we define f(m, j, x) = Sum_{k = j..m} binomial(m, k)*stirling2(k, j)*x^(m - k) then a(n-1) = f(2*n, 4, -2), n >= 2. - Milan Janjic, Apr 26 2009
a(n) = A014551(n) * A001045(n). - R. J. Mathar, Jul 08 2009
a(n) = 4*a(n-1) + a(n-2) - 4*a(n-3) = 5*a(n-1) - 4*a(n-2), a(0) = 0, a(1) = 1, a(2) = 5. - Wolfdieter Lang, Oct 18 2010
a(0) = 0, a(n+1) = a(n) + 2^(2*n). - Washington Bomfim, Jan 21 2011
A036555(a(n)) = 2*n. - Reinhard Zumkeller, Jan 28 2011
a(n) = Sum_{k = 1..floor((n+2)/3)} C(2*n + 1, n + 2 - 3*k). - Mircea Merca, Jun 25 2011
a(n) = Sum_{i = 1..n} binomial(2*n + 1, 2*i)/3. - Wesley Ivan Hurt, Mar 14 2015
a(n+1) = 2^(2*n) + a(n), a(0) = 0. - Ben Paul Thurston, Dec 27 2015
a(k*n)/a(n) = 1 + 4^n + ... + 4^((k-1)*n). - Gregory L. Simay, Jun 09 2016
Dirichlet g.f.: (PolyLog(s, 4) - zeta(s))/3. - Ilya Gutkovskiy, Jun 26 2016
A000120(a(n)) = n. - André Dalwigk, Mar 26 2018
a(m) divides a(m*n), in particular: a(2*n) == 0 (mod 5), a(3*n) == 0 (mod 3*7), a(5*n) == 0 (mod 11*31), etc. - M. F. Hasler, Oct 19 2018
a(n) = 4^(n-1) + a(n-1). - Bob Selcoe, Jan 01 2020
a(n) = A178415(1, n) = A347834(1, n-1), arrays, for n >= 1. - Wolfdieter Lang, Nov 29 2021
a(n) = A000225(2*n)/3. - John Keith, Jan 22 2022
a(n) = A080674(n) + 1 = A047849(n) - 1 = A163834(n) - 2 = A155701(n) - 3 = A163868(n) - 4 = A156605(n) - 7. - Ray Chandler, Jun 16 2023
EXAMPLE
Apply Collatz iteration to 9: 9, 28, 14, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5 and hence 16, 8, 4, 2, 1.
Apply Collatz iteration to 27: 27, 82, 41, 124, 62, 31, 94, 47, 142, 71, 214, 107, 322, 161, 484, 242, 121, 364, 182, 91, 274, 137, 412, 206, 103, 310, 155, 466, 233, 700, 350, 175, 526, 263, 790, 395, 1186, 593, 1780, 890, 445, 1336, 668, 334, 167, 502, 251, 754, 377, 1132, 566, 283, 850, 425, 1276, 638, 319, 958, 479, 1438, 719, 2158, 1079, 3238, 1619, 4858, 2429, 7288, 3644, 1822, 911, 2734, 1367, 4102, 2051, 6154, 3077, 9232, 4616, 2308, 1154, 577, 1732, 866, 433, 1300, 650, 325, 976, 488, 244, 122, 61, 184, 92, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5 and hence 16, 8, 4, 2, 1. [Corrected by Sean A. Irvine at the suggestion of Stephen Cornelius, Mar 04 2024]
a(5) = (4^5 - 1)/3 = 341 = 11111_4 = {(2^5 - 1) * (2^5 + 1)}/3 = 31 * 33/3 = 31 * 11. - Bernard Schott, Apr 29 2017
MAPLE
[seq((4^n-1)/3, n=0..40)];
A002450:=1/(4*z-1)/(z-1); # Simon Plouffe in his 1992 dissertation, dropping the initial zero
MATHEMATICA
Table[(4^n - 1)/3, {n, 0, 127}] (* Vladimir Joseph Stephan Orlovsky, Sep 29 2008 *)
LinearRecurrence[{5, -4}, {0, 1}, 30] (* Harvey P. Dale, Jun 23 2013 *)
PROG
(Magma) [ (4^n-1)/3: n in [0..25] ]; // Klaus Brockhaus, Oct 28 2008
(Magma) [n le 2 select n-1 else 5*Self(n-1)-4*Self(n-2): n in [1..70]]; // Vincenzo Librandi, Jun 13 2015
(PARI) a(n) = (4^n-1)/3;
(PARI) my(z='z+O('z^40)); Vec(z/((1-z)*(1-4*z))) \\ Altug Alkan, Oct 11 2015
(Haskell)
a002450 = (`div` 3) . a024036
a002450_list = iterate ((+ 1) . (* 4)) 0
-- Reinhard Zumkeller, Oct 03 2012
(Maxima) makelist((4^n-1)/3, n, 0, 30); /* Martin Ettl, Nov 05 2012 */
(GAP) List([0..25], n -> (4^n-1)/3); # Muniru A Asiru, Feb 18 2018
(Scala) ((List.fill(20)(4: BigInt)).scanLeft(1: BigInt)(_ * _)).scanLeft(0: BigInt)(_ + _) // Alonso del Arte, Sep 17 2019
(Python)
def A002450(n): return ((1<<(n<<1))-1)//3 # Chai Wah Wu, Jan 29 2023
CROSSREFS
Partial sums of powers of 4, A000302.
When converted to binary, this gives A094028.
Subsequence of A003714.
Primitive factors: A129735.
KEYWORD
nonn,easy,nice
STATUS
approved
Expansion of (1 - x)/((1 + x)*(1 - 2*x)).
+10
134
1, 0, 2, 2, 6, 10, 22, 42, 86, 170, 342, 682, 1366, 2730, 5462, 10922, 21846, 43690, 87382, 174762, 349526, 699050, 1398102, 2796202, 5592406, 11184810, 22369622, 44739242, 89478486, 178956970, 357913942, 715827882, 1431655766, 2863311530, 5726623062
OFFSET
0,3
COMMENTS
Conjecture: a(n) = the number of fractions in the infinite Farey row of 2^n terms with even denominators. Compare the Salamin & Gosper item in the Beeler et al. link. - Gary W. Adamson, Oct 27 2003
Counts closed walks starting and ending at the same vertex of a triangle. 3*a(n) = P(C_n, 3) chromatic polynomial for 3 colors on cyclic graph C_n. A078008(n) + 2*A001045(n) = 2^n provides decomposition of Pascal's triangle. - Paul Barry, Nov 17 2003
Permutations with one fixed point avoiding 123 and 132.
General form: iterate k -> 2^n - k. See also A001045. - Vladimir Joseph Stephan Orlovsky, Dec 11 2008
The inverse g.f. generates sequence 1, 0, -2, -2, -2, -2, ...
a(n) gives the number of oriented (i.e., unreduced for symmetry) meanders on an (n+2) X 3 rectangular grid; see A201145. - Jon Wild, Nov 22 2011
Pisano period lengths: 1, 1, 6, 1, 4, 6, 6, 2, 18, 4, 10, 6, 12, 6, 12, 2, 8, 18, 18, 4, ... - R. J. Mathar, Aug 10 2012
a(n) is the number of length n binary words that end in an odd length run of 0's if we do not include the first letter of the word in our run length count. a(4) =6 because we have 0000, 0010, 0110, 1000, 1010, 1110. - Geoffrey Critzer, Dec 16 2013
a(n) is the top left entry of the n-th power of any of the six 3 X 3 matrices [0, 1, 1; 1, 1, 1; 1, 0, 0], [0, 1, 1; 1, 1, 0; 1, 1, 0], [0, 1, 1; 1, 0, 1; 1, 1, 0], [0, 1, 1; 1, 1, 0; 1, 0, 1], [0, 1, 1; 1, 0, 1; 1, 0, 1] or [0, 1, 1; 1, 0, 0; 1, 1, 1]. - R. J. Mathar, Feb 04 2014
a(n) is the number of compositions of n into parts of two kinds without part 1. - Gregory L. Simay, Jun 04 2018
a(n) is the number of words of length n over a binary alphabet whose position in the lexicographic order is a multiple of three. a(3) = 2: aba, bab. - Alois P. Heinz, Apr 13 2022
a(n) is the number of words of length n over a ternary alphabet starting with a fixed letter (say, 'a') and ending in a different letter, such that no two adjacent letters are the same. a(4) = 6: abab, abac, abcb, acab, acac, acbc. - Ignat Soroko, Jul 19 2023
REFERENCES
Kenneth Edwards and Michael A. Allen, A new combinatorial interpretation of the Fibonacci numbers squared, Part II, Fib. Q., 58:2 (2020), 169-177.
I. P. Goulden and D. M. Jackson, Combinatorial Enumeration, John Wiley and Sons, N.Y., 1983, ex. 1.1.10a.
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000 (terms n=0..300 from T. D. Noe)
David Applegate, Omar E. Pol and N. J. A. Sloane, The Toothpick Sequence and Other Sequences from Cellular Automata, Congressus Numerantium, Vol. 206 (2010), 157-191. [There is a typo in Theorem 6: (13) should read u(n) = 4.3^(wt(n-1)-1) for n >= 2.]
Roland Bacher, Chebyshev polynomials, quadratic surds and a variation of Pascal's triangle, arXiv:1509.09054 [math.CO], 2015. See Section 4.6.
Paul Barry, A Catalan Transform and Related Transformations on Integer Sequences, Journal of Integer Sequences, Vol. 8 (2005), Article 05.4.5.
Paul Barry, Jacobsthal Decompositions of Pascal's Triangle, Ternary Trees, and Alternating Sign Matrices, Journal of Integer Sequences, 19, 2016, #16.3.5.
Paul Barry, Three Études on a sequence transformation pipeline, arXiv:1803.06408 [math.CO], 2018.
Paul Barry, A Note on Riordan Arrays with Catalan Halves, arXiv:1912.01124 [math.CO], 2019.
Paul Barry, On a Central Transform of Integer Sequences, arXiv:2004.04577 [math.CO], 2020.
M. Beeler, R. W. Gosper, and R. C. Schroeppel, R. HAKMEM. MIT AI Memo 239, Feb 29 1972. (Item #54 by Salamin & Gosper)
Ji Young Choi, A Generalization of Collatz Functions and Jacobsthal Numbers, J. Int. Seq., Vol. 21 (2018), Article 18.5.4.
Kenneth Edwards and Michael A. Allen, A new combinatorial interpretation of the Fibonacci numbers squared, arXiv:1907.06517 [math.CO], 2019.
E. Esteves-Rams, C. L. Azana Ricardo, and B. Aragon Fernandez, An alternative expression for counting the number of close-packaged polytypes, Z. Krist. 220 (2005) 592-595, eq (4)
Leonhard Euler, Introductio in analysin infinitorum, (1748), section 216.
Jia Huang, Partially Palindromic Compositions, J. Int. Seq. (2023) Vol. 26, Art. 23.4.1. See p. 13.
T. Mansour and A. Robertson, Refined Restricted Permutations Avoiding Subsets of Patterns of Length Three, arXiv:math/0204005 [math.CO], 2002.
FORMULA
Euler expands(1-x)/(1 - x - 2*x^2) into an infinite series and finds that the coefficient of the n-th term is (2^n + (-1)^n 2)/3. Section 226 shows that Euler could have easily found the recursion relation: a(n) = a(n-1) + 2a(n-2) with a(0) = 1 and a(1) = 0. - V. Frederick Rickey (fred-rickey(AT)usma.edu), Feb 10 2006. [Typos corrected by Jaume Oliver Lafont, Jun 01 2009]
a(n) = Sum_{k=0..floor(n/3)} binomial(n, f(n)+3*k) where f(n) = (0, 2, 1, 0, 2, 1, ...) = A080424(n). - Paul Barry, Feb 20 2003
E.g.f. (exp(2*x) + 2*exp(-x))/3. - Paul Barry, Apr 20 2003
a(n) = A001045(n) + (-1)^n = A000079(n) - 2*A001045(n). - Paul Barry, Feb 20 2003
a(n) = (2^n + 2*(-1)^n)/3. - Mario Catalani (mario.catalani(AT)unito.it), Aug 29 2003
a(n) = T(n, i/(2*sqrt(2)))*(-i*sqrt(2))^n - U(n-1, i/(2*sqrt(2)))*(-i*sqrt(2))^(n-1)/2. - Paul Barry, Nov 17 2003
From Paul Barry, Jul 30 2004: (Start)
a(n) = 2*a(n-1) + 2*(-1)^n for n > 0, with a(0)=1.
a(n) = Sum_{k=0..n} (-1)^k*(2^(n-k-1) + 0^(n-k)/2). (End)
a(n) = A014113(n-1) for n > 0; a(n) = A052953(n-1) - 2*(n mod 2) = sum of n-th row of the triangle in A108561. - Reinhard Zumkeller, Jun 10 2005
A137208(n+1) - 2*A137208(n) = a(n) signed. - Paul Curtz, Aug 03 2008
a(n) = A001045(n+1) - A001045(n) - Paul Curtz, Feb 09 2009
If p[1] =0, and p[i]=2, (i>1), and if A is Hessenberg matrix of order n defined by: A[i,j]=p[j-i+1], (i<=j), A[i,j]=-1, (i=j+1), and A[i,j]=0 otherwise. Then, for n>=1, a(n)=det A. - Milan Janjic, Apr 29 2010
a(n) = 2*(a(n-2) + a(n-3) + a(n-4) ... + a(0)), that is, twice the sum of all the previous terms except the last; with a(0) = 1 and a(1) = 0. - Benoit Jubin, Nov 21 2011
a(n+1) = 2*A001045(n). - Benoit Jubin, Nov 22 2011
G.f.: 1 - x + x*Q(0), where Q(k) = 1 + 2*x^2 + (2*k+3)*x - x*(2*k+1 + 2*x)/Q(k+1); (continued fraction). - Sergei N. Gladkovskii, Oct 05 2013
G.f.: 1+ x^2*Q(0), where Q(k) = 1 + 1/(1 - x*(4*k+1+2*x)/(x*(4*k+3+2*x) + 1/Q(k+1) )); (continued fraction). - Sergei N. Gladkovskii, Jan 01 2014
a(n) = 3*a(n-2) + 2*a(n-3). - David Neil McGrath, Sep 10 2014
a(n) = (-1)^n * A151575(n). - G. C. Greubel, Jun 28 2019
a(n)+a(n+1) = 2^n. - R. J. Mathar, Feb 24 2021
a(n) = -a(2-n) * (-2)^(n-1) = (3/2)*(a(n-1) + a(n-2)) - a(n-3) for all n in Z. - Michael Somos, Mar 18 2022
EXAMPLE
G.f. = 1 + 2*x^2 + 2*x^3 + 6*x^4 + 10*x^5 + 22*x^6 + ... - Michael Somos, Mar 18 2022
MATHEMATICA
Table[(2^n + 2*(-1)^n)/3, {n, 0, 40}] (* Vladimir Joseph Stephan Orlovsky, Dec 11 2008; modified by G. C. Greubel, Jun 28 2019 *)
CoefficientList[Series[(1-x)/(1-x-2x^2), {x, 0, 40}], x] (* Harvey P. Dale, Mar 30 2011 *)
LinearRecurrence[{1, 2}, {1, 0}, 40] (* Jean-François Alcover, Sep 23 2017 *)
PROG
(PARI) a(n)=(1<<n+2*(-1)^n)/3 \\ Charles R Greathouse IV, Jun 10 2011
(Magma) [(2^n + 2*(-1)^n)/3: n in [0..40]]; // G. C. Greubel, Jun 28 2019
(Sage) [(2^n + 2*(-1)^n)/3 for n in (0..40)] # G. C. Greubel, Jun 28 2019
(GAP) List([0..40], n-> (2^n + 2*(-1)^n)/3); # G. C. Greubel, Jun 28 2019
CROSSREFS
First differences of A001045.
See A151575 for a signed version.
Bisections: A047849, A020988.
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Nov 17 2002
STATUS
approved
a(n) = 2^(2n+1).
+10
124
2, 8, 32, 128, 512, 2048, 8192, 32768, 131072, 524288, 2097152, 8388608, 33554432, 134217728, 536870912, 2147483648, 8589934592, 34359738368, 137438953472, 549755813888, 2199023255552, 8796093022208, 35184372088832, 140737488355328, 562949953421312
OFFSET
0,1
COMMENTS
Same as Pisot sequences E(2, 8), L(2, 8), P(2, 8), T(2, 8). See A008776 for definitions of Pisot sequences.
In the Chebyshev polynomial of degree 2n, a(n) is the coefficient of x^2n. - Benoit Cloitre, Mar 13 2002
1/2 - 1/8 + 1/32 - 1/128 + ... = 2/5. - Gary W. Adamson, Mar 03 2009
From Adi Dani, May 15 2011: (Start)
Number of ways of placing an even number of indistinguishable objects in n + 1 distinguishable boxes with at most 3 objects in box.
Number of compositions of even natural numbers into n + 1 parts less than or equal to 3 (0 is counted as part). (End)
Also the number of maximal cliques in the (n+1)-Sierpinski tetrahedron graph for n > 0. - Eric W. Weisstein, Dec 01 2017
Assuming the Collatz conjecture is true, any starting number eventually leads to a power of 2. A number in this sequence can never be the first power of 2 in a Collatz sequence except of course for the Collatz sequence starting with that number. For example, except for 8, 4, 2, 1, any Collatz sequence that includes 8 must also include 16 (e.g., 5, 16, 8, 4, 2, 1). - Alonso del Arte, Oct 01 2019
First differences of A020988, and thus the "wavelengths" of the local maxima in A020986. See the Brillhart and Morton link, pp. 855-856. - John Keith, Mar 04 2021
REFERENCES
Adi Dani, Quasicompositions of natural numbers, Proceedings of III congress of mathematicians of Macedonia, Struga Macedonia 29 IX -2 X 2005 pages 225-238.
LINKS
J. Brillhart and P. Morton, A case study in mathematical research: the Golay-Rudin-Shapiro sequence, Amer. Math. Monthly, 103 (1996) 854-869.
Ling Gao, Graph assembly for spider and tadpole graphs, Master's Thesis, Cal. State Poly. Univ. (2023).
Tanya Khovanova, Recursive Sequences.
Mitchell Paukner, Lucy Pepin, Manda Riehl, and Jarred Wieser, Pattern Avoidance in Task-Precedence Posets, arXiv:1511.00080 [math.CO], 2015-2016.
Eric Weisstein's World of Mathematics, Maximal Clique.
Eric Weisstein's World of Mathematics, Sierpinski Tetrahedron Graph.
FORMULA
a(n) = 2*4^n.
a(n) = 4*a(n-1).
1 = 1/2 + Sum_{n >= 1} 3/a(n) = 3/6 + 3/8 + 3/32 + 3/128 + 3/512 + 3/2048 + ...; with partial sums: 1/2, 31/32, 127/128, 511/512, 2047/2048, ... - Gary W. Adamson, Jun 16 2003
From Philippe Deléham, Nov 23 2008: (Start)
a(n) = 2*A000302(n).
G.f.: 2/(1-4*x). (End)
a(n) = A081294(n+1) = A028403(n+1) - A000079(n+1) for n >= 1. a(n-1) = A028403(n) - A000079(n). - Jaroslav Krizek, Jul 27 2009
E.g.f.: 2*exp(4*x). - Ilya Gutkovskiy, Nov 01 2016
a(n) = A002063(n)/3 - A000302(n). - Zhandos Mambetaliyev, Nov 19 2016
a(n) = Sum_{k = 0..2*n} (-1)^(k+n)*binomial(4*n + 2, 2*k + 1); a(2*n) = Sum_{k = 0..2*n} binomial(4*n + 2, 2*k + 1) = A013776(n). - Peter Bala, Nov 25 2016
Product_{n>=0} (1 - 1/a(n)) = A132020. - Amiram Eldar, May 08 2023
EXAMPLE
G.f. = 2 + 8*x + 32*x^2 + 128*x^3 + 512*x^4 + 2048*x^5 + 8192*x^6 + 32768*x^7 + ...
From Adi Dani, May 15 2011: (Start)
a(1) = 8 because all compositions of even natural numbers into 2 parts less than or equal to 3 are:
for 0: (0, 0)
for 2: (0, 2), (2, 0), (1, 1)
for 4: (1, 3), (3, 1), (2, 2)
for 6: (3, 3).
a(2) = 32 because all compositions of even natural numbers into 3 parts less than or equal to 3 are:
for 0: (0, 0, 0)
for 2: (0, 0, 2), (0, 2, 0), (2, 0, 0), (0, 1, 1), (1, 0, 1) , (1, 1, 0)
for 4: (0, 1, 3), (0, 3, 1), (1, 0, 3), (1, 3, 0), (3, 0, 1), (3, 1, 0), (0, 2, 2), (2, 0, 2), (2, 2, 0), (1, 1, 2), (1, 2, 1), (2, 1, 1)
for 6: (0, 3, 3), (3, 0, 3), (3, 3, 0), (1, 2, 3), (1, 3, 2), (2, 1, 3), (2, 3, 1), (3, 1, 2), (3, 2, 1), (2, 2, 2)
for 8: (2, 3, 3), (3, 2, 3), (3, 3, 2).
(End)
MAPLE
seq(2^(2*n+1), n=0..24); # Nathaniel Johnston, Jun 25 2011
MATHEMATICA
Table[2^(2 n + 1), {n, 0, 24}]
2^(2 Range[20] - 1) (* Eric W. Weisstein, Dec 01 2017 *)
LinearRecurrence[{4}, {2}, 20] (* Eric W. Weisstein, Dec 01 2017 *)
CoefficientList[Series[2/(1 - 4 x), {x, 0, 20}], x] (* Eric W. Weisstein, Dec 01 2017 *)
PROG
(Magma) [2^(2*n+1): n in [0..30]]; // Vincenzo Librandi, May 16 2011
(PARI) a(n)=2<<(2*n) \\ Charles R Greathouse IV, Apr 07 2012
(PARI) a(n) = 2^(2*n+1) \\ Michel Marcus, Aug 12 2014
(Haskell)
a004171 = (* 2) . a000302
a004171_list = iterate (* 4) 2 -- Reinhard Zumkeller, Jan 09 2013
(GAP) List([0..30], n->2^(2*n+1)); # Muniru A Asiru, Mar 12 2019
(Scala) ((List.fill(20)(4: BigInt)).scanLeft(1: BigInt)(_ * _)).map(2 * _) // Alonso del Arte, Sep 12 2019
CROSSREFS
Absolute value of A009117. Essentially the same as A081294.
Cf. A132020, A164632. Equals A000980(n) + 2*A181765(n). Cf. A013776.
KEYWORD
easy,nonn
STATUS
approved

Search completed in 0.070 seconds