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.
%I A276004 #25 Jan 25 2022 20:09:55 %S A276004 0,0,0,1,0,0,0,0,1,2,1,1,0,1,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,1,1,2,3, %T A276004 2,2,1,2,1,2,1,2,1,1,1,2,1,1,0,0,1,2,1,1,0,0,1,2,1,1,0,1,1,2,1,2,0,0, %U A276004 1,2,1,1,0,1,0,1,0,1,0,1,1,2,1,2,0,1,0,1,0,1,0,1,0,1,0,1,0,0,0,1,0,0,0,0,1,2,1,1,0,1,0,1,0,1,0,0,0,1,0,0,0 %N A276004 a(n) is the number of nonzero digits in the factorial-base representation of n that are matched by more significant digits from left; a(n) = A060502(n) - A060128(n). %C A276004 a(n) is the number of times a nonzero digit d_i appears in position i of the factorial-base representation of n (where the least significant digit is in position 1) such that there is another nonzero digit d_j in such position j > i that j - d_j = i. %H A276004 Antti Karttunen, <a href="/A276004/b276004.txt">Table of n, a(n) for n = 0..40320</a> %H A276004 <a href="/index/Fa#facbase">Index entries for sequences related to factorial base representation</a> %F A276004 a(n) = A060502(n) - A060128(n). %F A276004 a(n) = A000120(2*A275727(n) AND A276010(n)), where AND is a bitwise-and given in A004198. %e A276004 For n=15 ("211" in factorial base) the least significant 1 at position 1 is matched by its immediate left neighbor 1 and also by 2 at position 3, as (2-1) = (3-2) = 1, the position where the least significant 1 itself is. However, this is counted just as one match, because this sequence gives the number of digits that are matched, instead of the number of digits that match, thus a(15)=1. %o A276004 (Scheme, two variants) %o A276004 (define (A276004 n) (- (A060502 n) (A060128 n))) %o A276004 (define (A276004 n) (let ((fv (list->vector (cons 0 (reverse (n->factbase n)))))) (let loop ((i 1) (c 0)) (if (>= i (vector-length fv)) c (let ((d (vector-ref fv i))) (cond ((zero? d) (loop (+ 1 i) c)) ((zero? (vector-ref fv (- i d))) (loop (+ 1 i) c)) (else (begin (vector-set! fv (- i d) 0) (loop (+ 1 i) (+ 1 c)))))))))) %o A276004 (define (n->factbase n) (let loop ((n n) (fex (if (zero? n) (list 0) (list))) (i 2)) (cond ((zero? n) fex) (else (loop (floor->exact (/ n i)) (cons (modulo n i) fex) (+ 1 i)))))) %Y A276004 Cf. A000120, A004198, A060128, A060502, A275727, A276010. %Y A276004 Cf. A276005 (indices of zeros), A276006 (of nonzeros). %Y A276004 Differs from A276007 for the first time at n=15, where a(15)=1, while A276004(15)=2. %K A276004 nonn,base %O A276004 0,10 %A A276004 _Antti Karttunen_, Aug 17 2016