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.

A338086 Duplicate the ternary digits of n, so each 0, 1 or 2 becomes 00, 11 or 22 respectively.

This page as a plain text file.
%I A338086 #19 May 07 2022 09:41:52
%S A338086 0,4,8,36,40,44,72,76,80,324,328,332,360,364,368,396,400,404,648,652,
%T A338086 656,684,688,692,720,724,728,2916,2920,2924,2952,2956,2960,2988,2992,
%U A338086 2996,3240,3244,3248,3276,3280,3284,3312,3316,3320,3564,3568,3572,3600,3604
%N A338086 Duplicate the ternary digits of n, so each 0, 1 or 2 becomes 00, 11 or 22 respectively.
%C A338086 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.
%C A338086 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).
%C A338086 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.
%H A338086 Kevin Ryde, <a href="/A338086/b338086.txt">Table of n, a(n) for n = 0..6560</a>
%F A338086 a(n) = A037314(n) + A208665(n) = 4*A037314(n) = (4/3)*A208665(n).
%F A338086 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.
%e A338086 n=73 is ternary 2201 which duplicates to 22220011 ternary = 8804 base 9 = 6484 decimal.
%o A338086 (PARI) a(n) = fromdigits(digits(n,3),9)<<2;
%o A338086 (Python)
%o A338086 from gmpy2 import digits
%o A338086 def A338086(n): return int(''.join(d*2 for d in digits(n,3)),3) # _Chai Wah Wu_, May 07 2022
%Y A338086 Cf. A037314, A208665, A163325, A163326, A163328.
%Y A338086 Cf. A020331 (ternary concatenation).
%Y A338086 Digit duplication in other bases: A001196, A338754.
%K A338086 base,nonn
%O A338086 0,2
%A A338086 _Kevin Ryde_, Oct 09 2020