OFFSET
0,2
COMMENTS
Also, numbers whose ternary digit runs are all even lengths (including 0 reckoned as no digits at all). Also, change ternary digits 0,1,2 to base 9 digits 0,4,8, and hence numbers which can be written in base 9 using only digits 0,4,8.
Digit duplication 00,11,22 can be compared to A037314 which is 0 above each so 00,01,02, or A208665 which is 0 below each so 00,10,20. Duplication is the sum of these, or any one is a suitable multiple of another (*3, *4, etc).
This sequence is the points on the X=Y diagonal of the ternary Z-order curve (see example table in A163328). The Z-order curve takes a point number p and splits its ternary digits alternately to X and Y coordinates so X(p) = A163325(p) and Y(p) = A163326(p). Duplicate digits in a(n) are the diagonal X(a(n)) = Y(a(n)) = n.
LINKS
Kevin Ryde, Table of n, a(n) for n = 0..6560
FORMULA
EXAMPLE
n=73 is ternary 2201 which duplicates to 22220011 ternary = 8804 base 9 = 6484 decimal.
PROG
(PARI) a(n) = fromdigits(digits(n, 3), 9)<<2;
(Python)
from gmpy2 import digits
def A338086(n): return int(''.join(d*2 for d in digits(n, 3)), 3) # Chai Wah Wu, May 07 2022
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Kevin Ryde, Oct 09 2020
STATUS
approved