login
a(n) = Sum_{k >= 0} f(d_k) * 3^k where Sum_{k >= 0} d_k * 8^k is the base 8 representation of n and f(k) = 0, 0, 0, 1, 2, 2, 2, 1 for k = 0..7, respectively.
2

%I #10 May 17 2020 12:13:54

%S 0,0,0,1,2,2,2,1,0,0,0,1,2,2,2,1,0,0,0,1,2,2,2,1,3,3,3,4,5,5,5,4,6,6,

%T 6,7,8,8,8,7,6,6,6,7,8,8,8,7,6,6,6,7,8,8,8,7,3,3,3,4,5,5,5,4,0,0,0,1,

%U 2,2,2,1,0,0,0,1,2,2,2,1,0,0,0,1,2,2,2

%N a(n) = Sum_{k >= 0} f(d_k) * 3^k where Sum_{k >= 0} d_k * 8^k is the base 8 representation of n and f(k) = 0, 0, 0, 1, 2, 2, 2, 1 for k = 0..7, respectively.

%C The lattice points with coordinates (A334888(n), a(n)) for n >= 0 form a Sierpinski carpet.

%H Rémy Sigrist, <a href="/A334889/b334889.txt">Table of n, a(n) for n = 0..4095</a> (n = 0..8^4-1)

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Sierpinski_carpet">Sierpinski carpet</a>

%F A153490(1 + A334888(n), 1 + a(n)) = 1.

%e For n = 42:

%e - 42 = 5*8^1 + 2*8^0,

%e - so a(42) = f(5)*3^1 + f(2)*3^0 = 2*3^1 + 0*3^0 = 6.

%o (PARI) a(n) = { my (f=[0, 0, 0, 1, 2, 2, 2, 1], d=Vecrev(digits(n, #f))); sum(k=0, #d-1, f[1+d[1+k]] * 3^k) }

%Y Cf. A153490, A334888.

%K nonn,base

%O 0,5

%A _Rémy Sigrist_, May 14 2020