close
login
A293974
Row sums of antidiagonals of the Sierpinski carpet A153490.
3
1, 2, 2, 4, 5, 4, 6, 6, 4, 8, 10, 8, 13, 14, 10, 14, 13, 8, 14, 16, 12, 18, 18, 12, 16, 14, 8, 16, 20, 16, 26, 28, 20, 28, 26, 16, 29, 34, 26, 40, 41, 28, 38, 34, 20, 34, 38, 28, 41, 40, 26, 34, 29, 16, 30, 36, 28, 44, 46, 32, 44, 40, 24, 42, 48, 36, 54, 54, 36, 48, 42, 24
OFFSET
1,2
COMMENTS
Also, sums of digits of terms of A292688, or Hamming weights of terms of A292689. See there or A153490 for definition / construction of the Sierpinski carpet.
LINKS
FORMULA
a(n) = A007953(A292688(n)) = A000120(A292689(n)) = Sum_{k=1..n} A153490(n,k), considering A153490 as triangle; could also be indexed as matrix (m,n = 1,...,oo) or "flattened" (linearized) using A000217.
From Leon Bernáth, Nov 23 2025: (Start)
Recurrence (with a(0)=0):
a(n) = 2*a(n-3^k) + a(2*3^k-n) for 3^k < n <= 2*3^k,
a(n) = 2*a(n-2*3^k) + 2*a(3*3^k-n) for 2*3^k < n <= 3^(k+1).
a(3^k) = 2^k and for all n >= 3^k, a(n) >= 2^k.
a(2*3^k) = 2^(k+1) and for all n >= 2*3^k, a(n) >= 2^(k+1). (End)
MATHEMATICA
A293974[i_]:=With[{a=Nest[ArrayFlatten[{{#, #, #}, {#, 0, #}, {#, #, #}}]&, {{1}}, i]}, Array[Total[Diagonal[a, #]]&, 3^i, 1-3^i]]; A293974[5] (* Generates 3^5 terms *) (* Paolo Xausa, May 14 2023 *)
PROG
(PARI) A293974(n, A=Mat(1))={while(#A<n, A=matrix(3*#A, 3*#A, i, j, if(A[(i+2)\3, (j+2)\3], i%3!=2||j%3!=2))); sum(k=1, n, A[k, n-k+1])}
(Python)
def build_sequence(k_max):
a = [0, 1, 2, 2]
N = 3
while N < 3**k_max:
mid = [2 * a[n - N] + a[2 * N - n] for n in range(N + 1, 2 * N + 1)]
right = [2 * a[n - 2 * N] + 2 * a[3 * N - n] for n in range(2 * N + 1, 3 * N + 1)]
a.extend(mid)
a.extend(right)
N *= 3
return a
# build_sequence(k_max) returns a list, containing the first 3^k_max entries of the sequence.
print(build_sequence(4)[1:])
# Leon Bernáth, Nov 23 2025
CROSSREFS
KEYWORD
nonn,look
AUTHOR
M. F. Hasler, Oct 24 2017
STATUS
approved