login
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

%I #21 Sep 10 2013 05:15:10

%S 1,1,2,10,49,268,1505,9667,81891,779193,7726623,80770479,921442854,

%T 11621384700,159894957124

%N Number of times an even number is encountered, when going from (n+1)!-1 to n!-1 using the iterative process described in A219652.

%C At least for n=7, 8, 9 and 10, a(n) is equal to a(n+1) when taken modulo n.

%H Antti Karttunen, <a href="/A219662/b219662.txt">Table of n, a(n) for n = 1..15</a>

%F a(n) = A219661(n) - A219663(n).

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

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

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

%o (Scheme):

%o (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)))))))))

%o (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)))))))

%Y Cf. A219666, A218542, A218543.

%K nonn,base

%O 1,3

%A _Antti Karttunen_, Dec 03 2012