

A097580


Base 3 representation of the concatenation of the first n numbers with the most significant digits first.


0



1, 110, 11120, 1200201, 121221020, 20021100110, 2022201111201, 212020020002100, 22121022020212200, 1011212101120110200001, 11101000122011021220211010, 121012010100112220022220220120
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


LINKS

Table of n, a(n) for n=1..12.


FORMULA

Consider numbers of the form 1, 12, 123, 1234, ..., N. Find the highest power of 3^p such that 3^p <= N. Then p = [log(N)/log(3)] and for 0 <= qi <= 2 [N/3^p] = q1 + r1 [r1/3^(p1)] = q2 + r2 ........................ rp/3^1 = qp + rp+1 rp+1/3^0 = qp+1 0 For N = 1234, p = [log(1234)/log(3)] = 6 division quot rem 1234/3^6 = 1 505 505/3^5 = 2 19 19/3^4 = 0 19 19/3^3 = 0 19 19/3^2 = 2 1 1/3^1 = 0 1 1/3^0 = 1 0 The sequence of quotients, top down, form the entry in the table for 1234. Obviously this algorithm works for any N.


EXAMPLE

The 4th concatenation of the integers > 0 is 1234. base(10,3,1234) = 1200201 the 4th entry in the table.


MATHEMATICA

Table[FromDigits[IntegerDigits[FromDigits[Flatten[Table[ IntegerDigits[n], {n, i}]]], 3]], {i, 12}] (* Harvey P. Dale, May 23 2011 *)


CROSSREFS

Sequence in context: A267867 A267889 A285696 * A216786 A295444 A295436
Adjacent sequences: A097577 A097578 A097579 * A097581 A097582 A097583


KEYWORD

base,nonn


AUTHOR

Cino Hilliard, Aug 29 2004


STATUS

approved



