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.
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
Offset: 0
Examples
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.
Links
- Rémy Sigrist, Table of n, a(n) for n = 0..10000
Crossrefs
See A327539 for similar sequences.
Programs
-
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
Formula
a(n) <= n.
Comments