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.

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.

This page as a plain text file.
%I A219662 #26 Jul 17 2025 14:45:10
%S A219662 1,1,2,10,49,268,1505,9667,81891,779193,7726623,80770479,921442854,
%T A219662 11621384700,159894957124
%N 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.
%C A219662 At least for n=7, 8, 9 and 10, a(n) is equal to a(n+1) when taken modulo n.
%H A219662 Antti Karttunen, <a href="/A219662/b219662.txt">Table of n, a(n) for n = 1..15</a>
%F A219662 a(n) = A219661(n) - A219663(n).
%e A219662 (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 A219662 (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 A219662 (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 A219662 (Scheme)
%o A219662 (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 A219662 (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 A219662 Cf. A034968, A219666, A218542, A218543, A219652, A219661, A219663.
%K A219662 nonn,base
%O A219662 1,3
%A A219662 _Antti Karttunen_, Dec 03 2012