login
The infinite trunk of ternary beanstalk with reversed subsections.
3

%I #5 Sep 12 2016 17:03:40

%S 0,2,8,4,26,20,16,12,10,80,72,68,62,56,52,46,42,38,34,30,28,242,232,

%T 224,216,212,204,198,194,188,180,176,170,164,160,152,144,140,134,126,

%U 122,116,110,106,100,96,92,88,84,82,728,716,706,698,688,680,672,664,656,648,644,634,626,618,610,602,594,590,582,576,572

%N The infinite trunk of ternary beanstalk with reversed subsections.

%C See A276623.

%H Antti Karttunen, <a href="/A276624/b276624.txt">Table of n, a(n) for n = 0..6250</a>

%F a(0) = 0; a(1) = 2; for n > 1, if 2*A054861(a(n-1))+1 is not a power of 3, then a(n) = 2*A054861(a(n-1)), otherwise a(n) = A000244(1+A081604(1+2*A054861(a(n-1)))) - 1.

%o (Scheme)

%o (definec (A276624 n) (cond ((zero? n) n) ((= n 1) 2) (else (let ((maybe_next (* 2 (A054861 (A276624 (- n 1)))))) (if (not (= 1 (A053735 (+ 1 maybe_next)))) maybe_next (+ -1 (A000244 (+ 1 (A081604 (+ 1 maybe_next))))))))))

%Y Cf. A000244, A053735, A054861, A081604, A276623.

%K nonn,base

%O 0,2

%A _Antti Karttunen_, Sep 11 2016