OFFSET
0,3
LINKS
Winston de Greef, Table of n, a(n) for n = 0..10000 (first 1001 terms from T. D. Noe)
Nicholas John Bizzell-Browning, LIE scales: Composing with scales of linear intervallic expansion, Ph. D. Thesis, Brunel Univ. (UK, 2024). See p. 143.
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
a026430_list = scanl (+) 0 a001285_list -- Reinhard Zumkeller, Jun 28 2013
(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)
def A026430(n): return n+(n-1>>1)+(n-1&1|(n.bit_count()&1^1)) # Chai Wah Wu, Mar 01 2023
CROSSREFS
KEYWORD
nonn,nice
AUTHOR
STATUS
approved