login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A019300 First n elements of Thue-Morse sequence A010060 read as a binary number. 7
0, 1, 3, 6, 13, 26, 52, 105, 211, 422, 844, 1689, 3378, 6757, 13515, 27030, 54061, 108122, 216244, 432489, 864978, 1729957, 3459915, 6919830, 13839660, 27679321, 55358643, 110717286, 221434573, 442869146, 885738292, 1771476585, 3542953171 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

LINKS

Ariel S Koiman, Table of n, a(n) for n = 0..3322

FORMULA

a(0) = 0, a(n+1) = 2a(n) + A010060(n). - Ralf Stephan, Sep 16 2003

MATHEMATICA

With[{tm=Nest[Flatten[#/.{0->{0, 1}, 1->{1, 0}}]&, {0}, 7]}, Table[ FromDigits[ Take[tm, n], 2], {n, 40}]] (* Harvey P. Dale, Mar 25 2015 *)

PROG

(Scheme)

(define rdc(lambda(x)(if(null? (cdr x))'()(cons (car x) (rdc (cdr x))))))

; if a bit is 1, get 2^i, where i is the index of that bit from right-left

(define F (lambda (c i)(if (eq? c #\1) (expt 2 i) 0)))

; gathers the sum of 2^index for all indices corresponding to a 1

(define fn (lambda (x sum i stop)(if (eq? i stop) sum (fn (list->string (rdc (string->list x))) (+ sum (F (string-ref x (-(string-length x) 1)) i)) (+ i 1)stop))))

(define f (lambda (x)(fn (substring thue 0 (+ x 1)) 0 0 (string-length (substring thue 0 (+ x 1))) )))

(define thue "0110100110010110") ; Feel free to add Thue-Morse sequence of whatever length here

; Ariel S Koiman, May 07 2013

(PARI) a(n)=sum(k=1, n, (hammingweight(k)%2)<<(n-k)) \\ Charles R Greathouse IV, May 08 2016

(PARI) first(n)=my(v=vector(n)); v[1]=1; for(k=2, n, v[k]=2*v[k-1]+hammingweight(k)%2); concat(0, v) \\ Charles R Greathouse IV, May 08 2016

CROSSREFS

Sequence in context: A255125 A267367 A265385 * A072762 A081254 A125049

Adjacent sequences:  A019297 A019298 A019299 * A019301 A019302 A019303

KEYWORD

nonn

AUTHOR

Jonas Wallgren

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy .

Last modified February 21 21:41 EST 2018. Contains 299427 sequences. (Running on oeis4.)