A130665 a(n) = Sum_{k=0..n} 3^wt(k), where wt() = A000120().
1, 4, 7, 16, 19, 28, 37, 64, 67, 76, 85, 112, 121, 148, 175, 256, 259, 268, 277, 304, 313, 340, 367, 448, 457, 484, 511, 592, 619, 700, 781, 1024, 1027, 1036, 1045, 1072, 1081, 1108, 1135, 1216, 1225, 1252, 1279, 1360, 1387, 1468, 1549, 1792, 1801, 1828, 1855
Offset: 0
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
- David Applegate, The movie version
- Hsien-Kuei Hwang, Svante Janson, and Tsung-Hsi Tsai, Identities and periodic oscillations of divide-and-conquer recurrences splitting at half, arXiv:2210.10968 [cs.DS], 2022, pp. 27, 31-32.
- Tanya Khovanova and Joshua Xiong, Nim Fractals, arXiv:1405.594291 [math.CO], 2014 and J. Int. Seq. 17 (2014) # 14.7.8.
- D. E. Knuth, Problem 11320 Amer. Math. Monthly, Vol. 114 No. 9 (Nov 2007) p. 835.
- Omar E. Pol, Illustration of initial terms: Fig. 1. Neighbors of the vertices, Fig. 2. Overlapping squares, Fig. 3. One-step bishop, (Nov 08 2009)
- N. J. A. Sloane, Catalog of Toothpick and Cellular Automata Sequences in the OEIS
- Mike Warburton, Ulam-Warburton Automaton - Counting Cells with Quadratics, arXiv:1901.10565 [math.CO], 2019.
Crossrefs
Programs
-
Haskell
a130665 = sum . map (3 ^) . (`take` a000120_list) . (+ 1) -- Reinhard Zumkeller, Apr 18 2012
-
Maple
u:=3; a[1]:=1; M:=30; for n from 1 to M do a[2*n] := (u+1)*a[n]; a[2*n+1] := u*a[n] + a[n+1]; od; t1:=[seq( a[n], n=1..2*M )]; # Gives sequence with a different offset
-
Mathematica
f[n_] := Sum[3^Count[ IntegerDigits[k, 2], 1], {k, 0, n}]; Array[f, 51, 0] (* Robert G. Wilson v, Jun 28 2010 *)
-
Python
def a(n): # formula version, n=10^10000 takes ~1 second if n == 0: return 1 msb = 1 << (n.bit_length() - 1) return msb**2 + 3 * a(n-msb) # Stefan Pochmann, Mar 15 2023
-
Python
def a(n): # optimized, n=10^50000 takes ~1 second n += 1 total = 0 power3 = 1 while n: log = n.bit_length() - 1 total += power3 << (2*log) n -= 1 << log power3 *= 3 return total # Stefan Pochmann, Mar 15 2023
Formula
With a different offset: a(1) = 1; a(n) = max { 3*a(k)+a(n-k) | 1 <= k <= n/2 }, for n>1.
a(2n+1) = 4*a(n) and a(2n) = 3*a(n-1) + a(n).
a(n) = (A147562(n+1) - 1)*3/4 + 1. - Omar E. Pol, Nov 08 2009
a(n) = A160410(n+1)/4. - Omar E. Pol, Nov 12 2009
Let r(x) = (1 + 4x + 3x^2), then (1 + 4x + 7x^2 + 16x^3 + ...) =
r(x)* r(x^2) * r(x^4) * r(x^8) * ... - Gary W. Adamson, Mar 26 2010
For asymptotics see the discussion in the comments in A006046. - N. J. A. Sloane, Mar 11 2021
a(n) = Sum_{k=0..floor(log_2(n+1))} 3^k * A360189(n,k). - Alois P. Heinz, Mar 06 2023
a(n) = msb^2 + 3*a(n-msb), where msb = A053644(n). - Stefan Pochmann, Mar 15 2023
Extensions
Simpler definition (and new offset) from David Applegate, Jun 11 2009
Lower limit of sum in definition changed from 1 to 0 by Robert G. Wilson v, Jun 28 2010
Comments