login
A219661
Number of steps to go from (n+1)!-1 to n!-1 with map x -> x - (sum of digits in factorial base representation of x).
14
1, 2, 5, 19, 83, 428, 2611, 18473, 150726, 1377548, 13851248, 152610108, 1835293041, 23925573979, 335859122743, 5049372125352, 80942722123544, 1378487515335424, 24858383452927384, 473228664468684846
OFFSET
1,2
FORMULA
a(n) = A219652((n+1)!-1) - A219652(n!-1).
a(n) = A219662(n) + A219663(n).
EXAMPLE
(1!)-1 (0) is reached from (2!)-1 (1) with one step by subtracting A034968(1) from 1.
(2!)-1 (1) is reached from (3!)-1 (5) with two steps by first subtracting A034968(5) from 5 -> 2, and then subtracting A034968(2) from 2 -> 1.
(3!)-1 (5) is reached from (4!)-1 (23) with five steps by repeatedly subtracting the sum of digits in factorial expansion as: 23 - 6 = 17, 17 - 5 = 12, 12 - 2 = 10, 10 - 3 = 7, 7 - 2 = 5.
Thus a(1)=1, a(2)=2 and a(3)=5.
MATHEMATICA
Table[Length@ NestWhileList[# - Total@ IntegerDigits[#, MixedRadix[Reverse@ Range[2, 120]]] &, (n + 1)! - 1, # > n! - 1 &] - 1, {n, 0, 8}] (* Michael De Vlieger, Jun 27 2016, Version 10.2 *)
PROG
(Scheme)
(define (A219661 n) (if (zero? n) n (let loop ((i (-1+ (A000142 (1+ n)))) (steps 1)) (cond ((isA000142? (1+ (A219651 i))) steps) (else (loop (A219651 i) (1+ steps)))))))
(define (isA000142? n) (and (> n 0) (let loop ((n n) (i 2)) (cond ((= 1 n) #t) ((not (zero? (modulo n i))) #f) (else (loop (/ n i) (1+ i)))))))
;; Alternative definition:
(define (A219661 n) (- (A219652 (-1+ (A000142 (1+ n)))) (A219652 (-1+ (A000142 n)))))
CROSSREFS
Row sums of A230420 and A230421.
Cf. also A213709 (analogous sequence for base-2), A261234 (for base-3).
Sequence in context: A138911 A181513 A262165 * A179566 A107377 A286886
KEYWORD
nonn
AUTHOR
Antti Karttunen, Dec 03 2012
EXTENSIONS
Terms a(16) - a(20) computed with Hiroaki Yamanouchi's Python-program by Antti Karttunen, Jun 27 2016
STATUS
approved