Displaying 1-10 of 65 results found.
a(n) is the sum of first n terms of A001285 (Thue-Morse sequence).
+20
30
0, 1, 3, 5, 6, 8, 9, 10, 12, 14, 15, 16, 18, 19, 21, 23, 24, 26, 27, 28, 30, 31, 33, 35, 36, 37, 39, 41, 42, 44, 45, 46, 48, 50, 51, 52, 54, 55, 57, 59, 60, 61, 63, 65, 66, 68, 69, 70, 72, 73, 75, 77, 78, 80, 81, 82, 84, 86, 87, 88, 90, 91, 93
FORMULA
a(0)=0, a(1)=1, a(2n) = 3n, a(2n+1) = -a(n) + a(n+1) + 3n. - Ralf Stephan, Oct 08 2003
G.f.: x*(3/(1 - x)^2 - Product_{k>=1} (1 - x^(2^k)))/2. - Ilya Gutkovskiy, Apr 03 2019
MATHEMATICA
A001285 = Table[ Mod[ Sum[ Mod[ Binomial[n, k], 2], {k, 0, n}], 3], {n, 0, 61}]; Accumulate[ A001285] (* Jean-François Alcover, Sep 25 2012 *)
Join[{0}, Accumulate[1 + ThueMorse /@ Range[0, 100]]] (* Jean-François Alcover, Sep 18 2019, from version 10.2 *)
PROG
(Haskell)
a026430 n = a026430_list !! n
(PARI) first(n)=my(v=vector(n)); v[1]=1; for(k=2, n, v[k]=if(k%2, v[k\2+1]-v[k\2])+k\2*3); concat(0, v) \\ Charles R Greathouse IV, May 09 2016
(Python)
from itertools import accumulate, islice
def A026430_gen(): # generator of terms
yield from (0, 1)
blist, s = [1], 1
while True:
c = [3-d for d in blist]
blist += c
yield from (s+d for d in accumulate(c))
s += sum(c)
(Python)
Length of n-th run of identical symbols in the Thue-Morse sequence A010060 (or A001285).
+20
19
1, 2, 1, 1, 2, 2, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 2, 1, 1, 2, 2, 2, 1, 1, 2, 2, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 2, 1, 1, 2, 2, 2, 1, 1, 2, 2, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 2, 1, 1, 2, 2, 2, 1, 1, 2, 2, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 2, 1, 1
COMMENTS
It appears that the sequence can be calculated by any of the following methods:
(1) Start with 1 and repeatedly replace 1 with 1, 2, 1 and 2 with 1, 2, 2, 2, 1;
(2) a(1) = 1, all terms are either 1 or 2 and, for n > 0, a(n) = 1 if the length of the n-th run of 2's is 1; a(n) = 2 if the length of the n-th run of consecutive 2's is 3, with each run of 2's separated by a run of two 1's;
Number of representations of n as a sum of Jacobsthal numbers (1 is allowed twice as a part). Partial sums are A003159. With interpolated zeros, g.f. is (Product_{k>=1} (1 + x^ A078008(k)))/2. - Paul Barry, Dec 09 2004
In other words, the consecutive 0's or 1's in A010060 or A010059. - Robin D. Saunders (saunders_robin_d(AT)hotmail.com), Sep 06 2006
The sequence (starting with the second term) can also be calculated by the following method:
Apply repeatedly to the string S_0 = [2] the following algorithm: take a string S, double it, if the last figure is 1, just add the last figure to the previous one, if the last figure is greater than one, decrease it by one unit and concatenate a figure 1 at the end. (This algorithm is connected with the interpretation of the sequence as a continued fraction expansion.) (End)
This sequence, starting with the second term, happens to be the continued fraction expansion of the biggest cluster point of the set {x in [0,1]: F^k(x) >= x, for all k in N}, where F denotes the Farey map (see A187061). - Carlo Carminati, Feb 28 2011
Starting with the second term, the fixed point of the substitution 2 -> 211, 1 -> 2. - Carlo Carminati, Mar 03 2011
It appears that this sequence contains infinitely many distinct palindromic subsequences. - Alexander R. Povolotsky, Oct 30 2016
Let tau defined by tau(0) = 01, tau(1) = 10 be the Thue-Morse morphism, with fixed point A010060. Consecutive runs in A010060 are 0, 11, 0, 1, 00, 1, 1, ..., which are coded by their lengths 1, 2, 1, 1, 2, ... Under tau^2 consecutive runs are mapped to consecutive runs:
tau^2(0) = 0110, tau^2(1) = 1001,
tau^2(00) = 01100110, tau^2(11) = 10011001.
The reason is that (by definition of a run!) runs of 0's and runs of 1's alternate in the sequence of runs, and this is inherited by the image of these runs under tau^2.
Under tau^2 the runs of length 1 are mapped to the sequence 1,2,1 of run lengths, and the runs of length 2 are mapped to the sequence 1,2,2,2,1 of run lengths. This proves John Layman's conjecture number (1): it follows that (a(n)) is fixed point of the morphism alpha
alpha: 1 -> 121, 2 -> 12221.
Since alpha(1) and alpha(2) are both palindromes, this also proves Alexander Povolotsky's conjecture.
(End)
LINKS
J.-P. Allouche, Andre Arnold, Jean Berstel, Srecko Brlek, William Jockusch, Simon Plouffe and Bruce E. Sagan, A sequence related to that of Thue-Morse, Discrete Math., Vol. 139, No. 1-3 (1995), pp. 455-461.
FORMULA
Asymptotic mean: lim_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 3/2. - Amiram Eldar, Jan 16 2022
MAPLE
## period-doubling routine:
double:=proc(SS)
NEW:=[op(S), op(S)]:
if op(nops(NEW), NEW)=1
then NEW:=[seq(op(j, NEW), j=1..nops(NEW)-2), op(nops(NEW)-1, NEW)+1]:
else NEW:=[seq(op(j, NEW), j=1..nops(NEW)-1), op(nops(NEW)-1, NEW)-1, 1]:
fi:
end proc:
# 10 loops of the above routine generate the first 1365 terms of the sequence
# (except for the initial term):
S:=[2]:
for j from 1 to 10 do S:=double(S); od:
S;
S:=[b]; M:=14;
for n from 1 to M do T:=subs({b=[b, a, a], a=[b]}, S);
S := map(x->op(x), T); od:
T:=subs({a=1, b=2}, S): T:=[1, op(T)]: [seq(T[n], n=1..40)];
MATHEMATICA
Length /@ Split@ Nest[ Flatten@ Join[#, # /. {1 -> 2, 2 -> 1}] &, {1}, 7]
NestList[ Flatten[# /. {1 -> {2}, 2 -> {1, 1, 2}}] &, {1}, 7] // Flatten (* Robert G. Wilson v, May 20 2014 *)
PROG
(Haskell)
import Data.List (group)
a026465 n = a026465_list !! (n-1)
a026465_list = map length $ group a010060_list
(PARI) See links.
CROSSREFS
A080426 is an essentially identical sequence with another set of constructions.
First differences of Thue-Morse sequence A001285.
+20
12
1, 0, -1, 1, -1, 0, 1, 0, -1, 0, 1, -1, 1, 0, -1, 1, -1, 0, 1, -1, 1, 0, -1, 0, 1, 0, -1, 1, -1, 0, 1, 0, -1, 0, 1, -1, 1, 0, -1, 0, 1, 0, -1, 1, -1, 0, 1, -1, 1, 0, -1, 1, -1, 0, 1, 0, -1, 0, 1, -1, 1, 0, -1, 1, -1, 0, 1, -1, 1, 0, -1, 0, 1, 0, -1, 1, -1, 0, 1, -1, 1, 0, -1, 1, -1, 0, 1, 0, -1, 0, 1, -1, 1, 0, -1, 0, 1, 0, -1, 1, -1, 0, 1, 0, -1
COMMENTS
Fixed point of the morphism a->abc, b->ac, c->b, with a = 1, b = 0, c = -1, starting with a(1) = 1. - Philippe Deléham
This sequence, interpreted as an infinite word, is squarefree.
Let & represent concatenation. For a word w of integers, let -w be the same word with each symbol negated. Then, starting with the empty word, this sequence can be obtained by iteratively applying the transformation T(w) = w & 1 & -w & 0 & -w & -1 & w. (End)
LINKS
J.-P. Allouche and Jeffrey Shallit, The Ubiquitous Prouhet-Thue-Morse Sequence, in C. Ding. T. Helleseth and H. Niederreiter, eds., Sequences and Their Applications: Proceedings of SETA '98, Springer-Verlag, 1999, pp. 1-16.
FORMULA
Recurrence: a(4*n) = a(n), a(4*n+1) = a(2*n+1), a(4*n+2) = 0, a(4*n+3) = -a(2*n+1), starting a(1) = 1.
G.f. A(x) satisfies 0 = f(A(x), A(x^2), A(x^4)) where f(u, v, w) = -v+w+u^2-v^2+2*w^2-2*u*w. - Michael Somos, Jul 08 2004
MATHEMATICA
Nest[ Function[ l, {Flatten[(l /. {0 -> {1, -1}, 1 -> {1, 0, -1}, -1 -> {0}})]}], {1}, 7] (* Robert G. Wilson v, Feb 26 2005 *)
PROG
(PARI) a(n)=if(n<1||valuation(n, 2)%2, 0, -(-1)^subst(Pol(binary(n)), x, 1)) /* Michael Somos, Jul 08 2004 */
(Python)
def A029883(n): return (bin(n).count('1')&1)-(bin(n-1).count('1')&1) # Chai Wah Wu, Mar 03 2023
a(n) = position of n-th 1 in A001285 or A010059 (Thue-Morse sequence).
+20
10
1, 4, 6, 7, 10, 11, 13, 16, 18, 19, 21, 24, 25, 28, 30, 31, 34, 35, 37, 40, 41, 44, 46, 47, 49, 52, 54, 55, 58, 59, 61, 64, 66, 67, 69, 72, 73, 76, 78, 79, 81, 84, 86, 87, 90, 91, 93, 96, 97, 100, 102, 103, 106, 107, 109, 112, 114, 115, 117, 120, 121, 124, 126, 127, 130
COMMENTS
Barbeau notes that if we let A = the first 2^k terms of this sequence and B = the first 2^k terms of A181155, then the two sets A and B have the same sum of powers for first up to the k-th power. I note it holds for 0th power also. - Michael Somos, Jun 09 2013
REFERENCES
Edward J. Barbeau, Power Play, MAA, 1997. See p. 104.
FORMULA
a(n) = Sum_{k=0..2n} mod(-2 + Sum_{j=0..k} floor(C(k, j)/2)}, 3). - Paul Barry, Dec 24 2004
EXAMPLE
Let k=2. Then A = {1,4,6,7} and B = {2,3,5,8} have the property that 1^0+4^0+6^0+7^0 = 2^0+3^0+5^0+8^0 = 4, 1^1+4^1+6^1+7^1 = 2^1+3^1+5^1+8^1 = 18, and 1^2+4^2+6^2+7^2 = 2^2+3^2+5^2+8^2 = 102. - Michael Somos, Jun 09 2013
MATHEMATICA
a[ n_] := If[ n < 1, 0, 2 n + Mod[ Total[ IntegerDigits[ n - 1, 2]], 2] - 1] (* Michael Somos, Jun 09 2013 *)
PROG
(PARI) {a(n) = if( n<1, 0, 2*n + subst( Pol( binary( n-1)), x, 1)%2 - 1)} /* Michael Somos, Jun 09 2013 */
(Python)
Convolution of Thue-Morse sequence A001285 with itself.
+20
10
1, 4, 8, 10, 12, 14, 15, 16, 22, 24, 23, 26, 29, 30, 34, 40, 38, 40, 43, 42, 47, 50, 52, 56, 55, 56, 62, 66, 64, 70, 71, 64, 78, 80, 75, 82, 83, 82, 88, 96, 89, 92, 100, 98, 102, 106, 105, 104, 111, 112, 114, 122, 118, 122, 125, 120, 130, 136, 131, 130, 141, 134, 138, 160
FORMULA
G.f.: (1/4)*(3/(1 - x) - Product_{k>=0} (1 - x^(2^k)))^2. - Ilya Gutkovskiy, Apr 03 2019
MATHEMATICA
P[n_, x_] := (bb = IntegerDigits[n, 2]) . x^Range[Length[bb]-1, 0, -1];
TM[n_] := 1 + Mod[P[n, 1], 2];
a[n_] := Sum[TM[k] TM[n-k], {k, 0, n}];
PROG
(PARI) a(n)=sum(k=0, n, (1+subst(Pol(binary(k)), x, 1)%2)*(1+subst(Pol(binary(n-k)), x, 1)%2)) \\ Ralf Stephan, Aug 23 2013
a(n) = t(3n), where t = A001285 (Thue-Morse sequence).
+20
5
1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1
Boustrophedon transform of 1 followed by Thue-Morse sequence A001285.
+20
5
1, 2, 5, 13, 34, 108, 415, 1841, 9381, 53733, 342086, 2395481, 18300250, 151453434, 1349856656, 12890177378, 131298281746, 1420980348324, 16283235530691, 196958363484995, 2507751773736087, 33526171616091612
LINKS
J. Millar, N. J. A. Sloane and N. E. Young, A new operation on sequences: the Boustrophedon transform, J. Combin. Theory, 17A (1996) 44-54 ( Abstract, pdf, ps).
MATHEMATICA
tm[n_] := Mod[Sum[Mod[Binomial[n, k], 2], {k, 0, n}], 3];
T[n_, k_] := (n!/k!) SeriesCoefficient[(1 + Sin[x])/Cos[x], {x, 0, n - k}];
a[n_] := Sum[T[n, k] If[k == 0, 1, tm[k - 1]], {k, 0, n}];
PROG
(Haskell)
a029885 n = sum $ zipWith (*) (a109449_row n) (1 : map fromIntegral a001285_list)
a(n) = t(1+3n), where t = A001285 (Thue-Morse sequence).
+20
4
2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 1, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 1, 1, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 1, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2
MATHEMATICA
Array[1 + Mod[DigitCount[3 # + 1, 2, 1], 2] &, 105, 0] (* Michael De Vlieger, Oct 03 2019 *)
a(n) = t(2+3n), where t = A001285 (Thue-Morse sequence).
+20
4
2, 1, 2, 2, 2, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 1, 1, 1, 2, 1
MATHEMATICA
Array[1 + Mod[DigitCount[3 # + 2, 2, 1], 2] &, 105, 0] (* Michael De Vlieger, Oct 06 2019 *)
Table[ThueMorse[2+3n], {n, 0, 100}]+1 (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Nov 29 2020 *)
Successive words in the formal D0L language that produces the Thue-Morse sequence A001285 (start with 1, map 1 -> 12, 2 -> 21).
+20
4
1, 12, 1221, 12212112, 1221211221121221, 12212112211212212112122112212112, 1221211221121221211212211221211221121221122121121221211221121221
REFERENCES
A. Salomaa, Jewels of Formal Language Theory. Computer Science Press, Rockville, MD, 1981, p. 5.
MATHEMATICA
Map[FromDigits, SubstitutionSystem[{1->{1, 2}, 2->{2, 1}}, {1}, 7]] (* Paolo Xausa, Dec 24 2023 *)
Search completed in 0.049 seconds
|