login
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

%I #43 Mar 30 2017 21:52:34

%S 1,2,5,12,29,74,196,530,1445,3956,10862,29901,82592,229233,639967,

%T 1797288,5073707,14381347,40890492,116559600,333043360,953890490,

%U 2738788806,7881915828,22729464587,65652788211,189866467219,549596773550,1592118137130,4615680732717,13392399641613,38894563977633,113074467549440,329080350818600,958725278344368,2795854777347489

%N 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).

%H Hiroaki Yamanouchi, <a href="/A261234/b261234.txt">Table of n, a(n) for n = 0..100</a>

%H Antti Karttunen, <a href="/A261234/a261234_4.c.txt">Naive C-program for computing the terms of A261234, A261236 and A261237 at the same time</a>

%H Hiroaki Yamanouchi, <a href="/A261234/a261234.py.txt">Fast Python-program for computing terms of A213709, A261234 and analogous sequences in other bases</a>

%F a(n) = A261236(n) + A261237(n).

%t Table[Length@ NestWhileList[# - Total@ IntegerDigits[#, 3] &, 3^(n + 1) - 1, # > 3^n - 1 &] - 1, {n, 0, 16}] (* _Michael De Vlieger_, Jun 27 2016 *)

%o (Scheme, three variants)

%o (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))))))

%o (define (A261234 n) (- (A261233 (+ 1 n)) (A261233 n)))

%o (define (A261234 n) (- (A261231 (A000244 (+ 1 n))) (A261231 (A000244 n))))

%Y Cf. A000244, A054861, A261231, A261230.

%Y First differences of A261232 and A261233.

%Y Sum of A261236 and A261237.

%Y Cf. A261235 (first differences of this sequence).

%Y Cf. also A213709.

%K nonn,base

%O 0,2

%A _Antti Karttunen_, Aug 13 2015

%E a(23)-a(35) from _Hiroaki Yamanouchi_, Aug 16 2015