|
|
A329424
|
|
Starting from n: as long as the decimal representation starts with a positive multiple of 3, divide the largest such prefix by 3; a(n) corresponds to the final value.
|
|
3
|
|
|
0, 1, 2, 1, 4, 5, 2, 7, 8, 1, 10, 11, 4, 13, 14, 5, 16, 17, 2, 19, 20, 7, 22, 23, 8, 25, 26, 1, 28, 29, 10, 11, 4, 11, 14, 5, 4, 17, 2, 13, 40, 41, 14, 43, 44, 5, 46, 47, 16, 49, 50, 17, 52, 53, 2, 55, 56, 19, 58, 59, 20, 7, 22, 7, 8, 25, 22, 1, 28, 23, 70, 71
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
As long as we have a number whose decimal representation is the concatenation of a positive multiple of 3, say u, and a minimal string possibly empty, say v, we replace this number with the concatenation of u/3 and v; eventually none of the prefixes will be a positive multiple of 3.
|
|
LINKS
|
|
|
FORMULA
|
a(n) <= n.
|
|
EXAMPLE
|
For n = 1011:
- 1011 gives 1011/3 = 337,
- 337 gives 33/3 followed by 7 = 117,
- 117 gives 117/3 = 39,
- 39 gives 39/3 = 13,
- neither 1 nor 13 is a multiple of 3, so a(1011) = 13.
|
|
PROG
|
(PARI) t(n) = if (n==0, 0, n%3==0, n/3, 10*t(n\10)+(n%10))
a(n) = while (n!=n=t(n), ); n
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|