OFFSET
0,3
LINKS
Wikipedia, Vicsek fractal.
FORMULA
Conjecture: a(n) = O(n^log_3(5)). This is motivated by the log_3(5) Hausdorff dimension of the diagonal Vicsek fractal.
Conjecture: a(3n) = 5*a(n). This is motivated by the recursive construction of the diagonal Vicsek fractal.
Conjecture: a(2n+1) = A151907(n)
EXAMPLE
For n=3, a(3)=5 by counting x's in the following ASCII pattern:
x.x
.x.
x.x
For n=4, a(4)=6 by counting x's in the following ASCII pattern:
x...
.x.x
..x.
.x.x
For n=5, a(5)=9 by counting x's in the following ASCII pattern:
x...x
.x.x.
..x..
.x.x.
x...x
Generally for odd n, one can construct a diagonal Vicsek fractal on a 3^k X 3^k matrix such that 3^k >= n: place an n X n square in the center and count the x's.
For even n, there are 4 ways to most "centrally" place an n X n square; however, due to 4-fold symmetry of the diagonal Vicsek fractal they result in the same value. In our ASCII convention above we use the top-left selection.
PROG
(Python)
import copy
def combine(matrix): #accepts a matrix of matrices and fuses them
aggregate = []
for row in matrix:
for j in range(0, len(matrix[0][0])):
agg_row = []
for block in row:
agg_row += block[j]
aggregate.append(agg_row)
return aggregate
def descend(seed, zero, source, bound): #general fractal constructor
for i in range(0, bound):
for q in range(0, len(source)):
for r in range(0, len(source[q])):
if source[q][r] == 1:
source[q][r] = copy.deepcopy(seed)
if source[q][r] == 0:
source[q][r] = copy.deepcopy(zero)
source = combine(source) #fuse it up
return source
def count(matrix, bound):
counter = 0
center_x, center_y = len(matrix)//2, len(matrix)//2
shift_limit = bound//2
if len(matrix)%2 == 1 and bound % 2 == 1:
for i in range(-shift_limit, shift_limit+1):
for j in range(-shift_limit, shift_limit+1):
if matrix[center_x+i][center_y+j] == 1:
counter += 1
if len(matrix)%2 == 1 and bound % 2 == 0:
for i in range(-shift_limit, shift_limit):
for j in range(-shift_limit, shift_limit):
if matrix[center_x+i][center_y+j] == 1:
counter += 1
return counter
seed = [[1, 0, 1], [0, 1, 0], [1, 0, 1]]
source = [[1]]
zero = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
#example with n=5
n=5
print(count(descend(seed, zero, source, 2), 5)) #this constructs a 3^2 X 3^2 matrix and counts the center 5 X 5 matrix
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Sidharth Ghoshal, May 28 2024
STATUS
approved