%I #9 Oct 30 2013 11:51:01
%S 0,1,5,2,23,17,12,10,7,119,109,102,97,92,85,79,74,70,63,57,52,48,46,
%T 40,35,30,28,25,719,704,693,680,670,658,648,641,630,623,612,605,597,
%U 584,574,562,552,545,534,527,516,509,501,492,486,481,476,465,455,443
%N The infinite trunk of factorial beanstalk (A219666) with reversed subsections.
%C Can be viewed also as an irregular table: after the initial zero on row 0, start each row n with (n!)-1 and subtract repeatedly the sum of factorial expansion digits (A034968) to get successive terms, until the number that has already been listed [which is always (n-1)!-1] is encountered, which is not listed second time, but instead, the current row is finished and the next row starts with ((n+1)!-1), with the same process repeated.
%C Contains the terms in the infinite trunk of factorial beanstalk (A219666) listed in partially reversed manner: after the initial zero each subsequence lists A219661(n) successive terms from A219666, descending from (n!)-1 downwards.
%H Antti Karttunen, <a href="/A230416/b230416.txt">Rows 0..7, flattened</a>
%F For n < 3, a(n) = (n+1)!-1, and for n >= 3, a(n) = (k+2)!-1 if A219651(a(n-1)) is of form k!-1, otherwise just A219651(a(n-1)).
%F a(n) = A219666(A230432(n)). [Consequence of the definitions]
%e This irregular table begins as:
%e 0;
%e 1;
%e 5, 2;
%e 23, 17, 12, 10, 7;
%e 119, 109, 102, 97, 92, 85, 79, 74, 70, 63, 57, 52, 48, 46, 40, 35, 30, 28, 25;
%e ...
%e After the initial zero (on row 0), each row n is A219661(n) elements long.
%o (Scheme, with _Antti Karttunen_'s IntSeq-library for memoizing definec-macro)
%o (definec (A230416 n) (cond ((< n 3) (- (A000142 (+ 1 n)) 1)) ((A219651 (A230416 (-1+ n))) => (lambda (next) (cond ((which_in_A000142? (+ 1 next)) => (lambda (k) (- (A000142 (+ k 2)) 1))) (else next))))))
%o (define (which_in_A000142? n) (and (> n 0) (let loop ((n n) (i 2)) (cond ((= 1 n) (- i 1)) ((not (zero? (modulo n i))) #f) (else (loop (/ n i) (1+ i)))))))
%Y Cf. A219666, A219661, A000142, A219651.
%Y The rows are the initial portions of every (n!-1)th row in A219659.
%Y Analogous sequence for binary system: A218616.
%K nonn,tabf
%O 0,3
%A _Antti Karttunen_, Oct 22 2013
|