cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A373226 Number of points in a diagonal Vicsek fractal subset of an n X n square.

Original entry on oeis.org

0, 1, 2, 5, 6, 9, 10, 13, 18, 25, 26, 29, 30, 33, 38, 45, 46, 49, 50, 53, 58, 65, 74, 85, 90, 97, 110, 125, 126, 129, 130, 133, 138, 145, 146, 149, 150, 153, 158, 165, 174, 185, 190, 197, 210, 225, 226, 229, 230, 233
Offset: 0

Views

Author

Sidharth Ghoshal, May 28 2024

Keywords

Examples

			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.
		

Crossrefs

Cf. A151907 (conjectured to be only the odd terms).

Programs

  • 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

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)