OFFSET
0,3
COMMENTS
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.
LINKS
Antti Karttunen, Rows 0..7, flattened
FORMULA
EXAMPLE
This irregular table begins as:
0;
1;
5, 2;
23, 17, 12, 10, 7;
119, 109, 102, 97, 92, 85, 79, 74, 70, 63, 57, 52, 48, 46, 40, 35, 30, 28, 25;
...
After the initial zero (on row 0), each row n is A219661(n) elements long.
PROG
(Scheme, with Antti Karttunen's IntSeq-library for memoizing definec-macro)
(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))))))
(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)))))))
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
Antti Karttunen, Oct 22 2013
STATUS
approved