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.

Showing 1-4 of 4 results.

A037314 Numbers whose base-3 and base-9 expansions have the same digit sum.

Original entry on oeis.org

0, 1, 2, 9, 10, 11, 18, 19, 20, 81, 82, 83, 90, 91, 92, 99, 100, 101, 162, 163, 164, 171, 172, 173, 180, 181, 182, 729, 730, 731, 738, 739, 740, 747, 748, 749, 810, 811, 812, 819, 820, 821, 828, 829, 830, 891, 892, 893, 900, 901, 902, 909, 910, 911
Offset: 0

Views

Author

Keywords

Comments

a(n) = Sum_{i=0..m} d(i)*9^i, where Sum_{i=0..m} d(i)*3^i is the base-3 representation of n.
Numbers that can be written using only digits 0, 1 and 2 in base 9. Also, write n in base 3, read as base 9: (3) [n] (9) in base change notation. a(3n+k) = 9a(n)+k for k in {0,1,2}. - Franklin T. Adams-Watters, Jul 24 2006
Also, every term k corresponds to a unique pair i,j with k = a(i) + 3*a(j) (similarly to the Moser-de Bruijn sequence). - Luis Rato, May 02 2024

Crossrefs

Cf. A007089, A208665, A338086 (ternary digit duplication).

Programs

  • Julia
    function a(n)
        m, r, b = n, 0, 1
        while m > 0
            m, q = divrem(m, 3)
            r += b * q
            b *= 9
        end
    r end
    [a(n) for n in 0:53] |> println # Peter Luschny, Jan 03 2021
  • Mathematica
    Table[FromDigits[RealDigits[n, 3], 9], {n, 1, 100}] (* Clark Kimberling, Aug 14 2012 *)
    Select[Range[0,1000],Total[IntegerDigits[#,3]]==Total[IntegerDigits[#,9]]&] (* Harvey P. Dale, Feb 17 2020 *)
  • PARI
    a(n) = {my(d = digits(n, 3)); subst(Pol(d), x, 9);} \\ Michel Marcus, Apr 09 2015
    

Formula

G.f. f(x) = Sum_{j>=0} 9^j*x^(3^j)*(1+x^(3^j)-2*x^(2*3^j))/((1-x)*(1-x^(3^(j+1)))) satisfies f(x) = 9*(x^2+x+1)*f(x^3) + x*(1+2*x)/(1-x^3). - Robert Israel, Apr 13 2015

Extensions

Edited by N. J. A. Sloane at the suggestion of Andrew S. Plewe, Jun 08 2007
Offset changed to 0 by Clark Kimberling, Aug 14 2012

A163328 Square array A, where entry A(y,x) has the ternary digits of x interleaved with the ternary digits of y, converted back to decimal. Listed by antidiagonals: A(0,0), A(0,1), A(1,0), A(0,2), A(1,1), A(2,0), ...

Original entry on oeis.org

0, 1, 3, 2, 4, 6, 9, 5, 7, 27, 10, 12, 8, 28, 30, 11, 13, 15, 29, 31, 33, 18, 14, 16, 36, 32, 34, 54, 19, 21, 17, 37, 39, 35, 55, 57, 20, 22, 24, 38, 40, 42, 56, 58, 60, 81, 23, 25, 45, 41, 43, 63, 59, 61, 243, 82, 84, 26, 46, 48, 44, 64, 66, 62, 244, 246, 83, 85, 87, 47, 49
Offset: 0

Views

Author

Antti Karttunen, Jul 29 2009

Keywords

Examples

			From _Kevin Ryde_, Oct 06 2020: (Start)
Array A(y,x) read by downwards antidiagonals, so 0, 1,3, 2,4,6, etc.
        x=0   1   2   3   4   5   6   7   8
      +--------------------------------------
  y=0 |   0,  1,  2,  9, 10, 11, 18, 19, 20,
    1 |   3,  4,  5, 12, 13, 14, 21, 22,
    2 |   6,  7,  8, 15, 16, 17, 24,
    3 |  27, 28, 29, 36, 37, 38,
    4 |  30, 31, 32, 39, 40,
    5 |  33, 34, 35, 42,
    6 |  54, 55, 56,
    7 |  57, 58,
    8 |  60,
(End)
		

Crossrefs

Inverse: A163329. Transpose: A163330. Cf. A037314 (row y=0), A208665 (column x=0)
Cf. A054238 is an analogous sequence for binary. Cf. A007089, A163327, A163332, A163334.

Programs

Formula

a(n) = A037314(A025581(n)) + 3*A037314(A002262(n))
a(n) = A163327(A163330(n)).

Extensions

Edited by Charles R Greathouse IV, Nov 01 2009

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

Original entry on oeis.org

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
Offset: 0

Views

Author

Kevin Ryde, Oct 09 2020

Keywords

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.

Examples

			n=73 is ternary 2201 which duplicates to 22220011 ternary = 8804 base 9 = 6484 decimal.
		

Crossrefs

Cf. A020331 (ternary concatenation).
Digit duplication in other bases: A001196, A338754.

Programs

  • 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

Formula

a(n) = A037314(n) + A208665(n) = 4*A037314(n) = (4/3)*A208665(n).
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.

A163481 Row 0 of A163336 (column 0 of A163334).

Original entry on oeis.org

0, 5, 6, 47, 48, 53, 54, 59, 60, 425, 426, 431, 432, 437, 438, 479, 480, 485, 486, 491, 492, 533, 534, 539, 540, 545, 546, 3827, 3828, 3833, 3834, 3839, 3840, 3881, 3882, 3887, 3888, 3893, 3894, 3935, 3936, 3941, 3942, 3947, 3948, 4313, 4314, 4319
Offset: 0

Views

Author

Antti Karttunen, Jul 29 2009

Keywords

Crossrefs

Cf. A163480 (X axis), A208665 (Z-order Y axis).

Programs

  • PARI
    a(n) = my(v=digits(n,3),s=Mod(0,2)); for(i=1,#v, s+=v[i]; v[i]=3*v[i]+if(s,2)); fromdigits(v,9); \\ Kevin Ryde, Oct 06 2020

Formula

From Kevin Ryde, Oct 06 2020: (Start)
a(n) = A163332(A208665(n)), including at n=0 by reckoning A208665(0)=0.
a(n) = 3*A163480(n) + (2 if n odd).
(End)
Showing 1-4 of 4 results.