|
|
A338086
|
|
Duplicate the ternary digits of n, so each 0, 1 or 2 becomes 00, 11 or 22 respectively.
|
|
7
|
|
|
0, 4, 8, 36, 40, 44, 72, 76, 80, 324, 328, 332, 360, 364, 368, 396, 400, 404, 648, 652, 656, 684, 688, 692, 720, 724, 728, 2916, 2920, 2924, 2952, 2956, 2960, 2988, 2992, 2996, 3240, 3244, 3248, 3276, 3280, 3284, 3312, 3316, 3320, 3564, 3568, 3572, 3600, 3604
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
|
|
FORMULA
|
a(n) = 4*Sum_{i=0..k} d[i]*9^i where the ternary expansion of n is n = Sum_{i=0..k} d[i]*3^i with digits d[i]=0,1,2.
|
|
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
|
Cf. A020331 (ternary concatenation).
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|