login
A261234
a(n) = number of steps to reach (3^n)-1 when starting from k = (3^(n+1))-1 and repeatedly applying the map that replaces k with k - (sum of digits in base-3 representation of k).
11
1, 2, 5, 12, 29, 74, 196, 530, 1445, 3956, 10862, 29901, 82592, 229233, 639967, 1797288, 5073707, 14381347, 40890492, 116559600, 333043360, 953890490, 2738788806, 7881915828, 22729464587, 65652788211, 189866467219, 549596773550, 1592118137130, 4615680732717, 13392399641613, 38894563977633, 113074467549440, 329080350818600, 958725278344368, 2795854777347489
OFFSET
0,2
FORMULA
a(n) = A261236(n) + A261237(n).
MATHEMATICA
Table[Length@ NestWhileList[# - Total@ IntegerDigits[#, 3] &, 3^(n + 1) - 1, # > 3^n - 1 &] - 1, {n, 0, 16}] (* Michael De Vlieger, Jun 27 2016 *)
PROG
(Scheme, three variants)
(definec (A261234 n) (let ((end (- (A000244 n) 1))) (let loop ((k (- (A000244 (+ 1 n)) 1)) (s 0)) (if (= k end) s (loop (* 2 (A054861 k)) (+ 1 s))))))
(define (A261234 n) (- (A261233 (+ 1 n)) (A261233 n)))
(define (A261234 n) (- (A261231 (A000244 (+ 1 n))) (A261231 (A000244 n))))
CROSSREFS
First differences of A261232 and A261233.
Sum of A261236 and A261237.
Cf. A261235 (first differences of this sequence).
Cf. also A213709.
Sequence in context: A036671 A152171 A132807 * A368984 A324787 A333888
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Aug 13 2015
EXTENSIONS
a(23)-a(35) from Hiroaki Yamanouchi, Aug 16 2015
STATUS
approved