login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A219662
Number of times an even number is encountered, when going from (n+1)!-1 to n!-1 using the iterative process described in A219652.
8
1, 1, 2, 10, 49, 268, 1505, 9667, 81891, 779193, 7726623, 80770479, 921442854, 11621384700, 159894957124
OFFSET
1,3
COMMENTS
At least for n=7, 8, 9 and 10, a(n) is equal to a(n+1) when taken modulo n.
LINKS
FORMULA
a(n) = A219661(n) - A219663(n).
EXAMPLE
(1!)-1 (0) is reached from (2!)-1 (1) with one step by subtracting A034968(1) from 1. Zero is an even number, so a(1)=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. Two is an even number, but one is not, 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 only 12 and 10 are even numbers, so a(3)=2.
PROG
(Scheme):
(definec (A219662 n) (if (< n 2) n (let loop ((i (- (A000142 (1+ n)) (A000217 n) 1)) (s 0)) (cond ((isA000142? (1+ i)) (+ s (- 1 (modulo i 2)))) (else (loop (A219651 i) (+ s (- 1 (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