cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

Original entry on oeis.org

1, 2, 5, 19, 83, 428, 2611, 18473, 150726, 1377548, 13851248, 152610108, 1835293041, 23925573979, 335859122743, 5049372125352, 80942722123544, 1378487515335424, 24858383452927384, 473228664468684846
Offset: 1

Views

Author

Antti Karttunen, Dec 03 2012

Keywords

Examples

			(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.
		

Crossrefs

Row sums of A230420 and A230421.
Cf. also A213709 (analogous sequence for base-2), A261234 (for base-3).

Programs

  • 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 *)
  • 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)))))

Formula

a(n) = A219652((n+1)!-1) - A219652(n!-1).
a(n) = A219662(n) + A219663(n).

Extensions

Terms a(16) - a(20) computed with Hiroaki Yamanouchi's Python-program by Antti Karttunen, Jun 27 2016