login
A219663
Number of times an odd number is encountered, when going from (n+1)!-1 to n!-1 using the iterative process described in A219652.
8
0, 1, 3, 9, 34, 160, 1106, 8806, 68835, 598355, 6124625, 71839629, 913850187, 12304189279, 175964165619
OFFSET
1,3
COMMENTS
Ratio a(n)/A219662(n) develops as follows:
0, 1, 1.5, 0.9, 0.694..., 0.597..., 0.735..., 0.911..., 0.841..., 0.768..., 0.793..., 0.889..., 0.992..., 1.059..., 1.100...
Compare this to how the ratio A218543(n)/A218542(n) develops (ratios listed in entry A218543) and see also the associated graphs plotted by OEIS Server.
FORMULA
a(n) = A219661(n) - A219662(n).
EXAMPLE
(1!)-1 (0) is reached from (2!)-1 (1) with one step by subtracting A034968(1) from 1. Zero is not an odd number, so a(1)=0.
(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. Two is not an odd number, but one is, so a(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. Of these (after 23) only 17, 7 and 5 are odd numbers, so a(3)=3.
PROG
(Scheme):
(definec (A219663 n) (if (< n 2) 0 (let loop ((i (- (A000142 (1+ n)) (A000217 n) 1)) (s 0)) (cond ((isA000142? (1+ i)) (+ s (modulo i 2))) (else (loop (A219651 i) (+ s (modulo i 2))))))))
(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)))))))
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Dec 03 2012
STATUS
approved