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.

A276007 a(n) = number of nonzero digits in factorial base representation of n that hit less significant nonzero digits to the right. See comments for exact definition.

This page as a plain text file.
%I A276007 #11 Aug 17 2016 22:19:53
%S A276007 0,0,0,1,0,0,0,0,1,2,1,1,0,1,0,2,0,1,0,0,0,1,0,0,0,0,0,1,0,0,1,1,2,3,
%T A276007 2,2,1,2,1,3,1,2,1,1,1,2,1,1,0,0,1,2,1,1,0,0,2,3,2,2,0,1,1,3,1,2,0,0,
%U A276007 1,2,1,1,0,1,0,2,0,1,0,1,1,3,1,2,0,2,0,3,0,2,0,1,0,2,0,1,0,0,0,1,0,0,0,0,1,2,1,1,0,1,0,2,0,1,0,0,0,1,0,0,0
%N A276007 a(n) = number of nonzero digits in factorial base representation of n that hit less significant nonzero digits to the right. See comments for exact definition.
%C A276007 a(n) = Number of times a nonzero digit d_i appears in such position i of factorial base representation of n for which there is another nonzero digit in position i - d_i. Here one-based indexing is used for digits, thus the least significant digit is in position 1.
%H A276007 Antti Karttunen, <a href="/A276007/b276007.txt">Table of n, a(n) for n = 0..40320</a>
%H A276007 <a href="/index/Fa#facbase">Index entries for sequences related to factorial base representation</a>
%e A276007 For n=15 ("211" in factorial base) both 2 at position 3 and 1 at position 2 hit the least significant 1 at position 1 as (2-1) = (3-2) = 1, the position where the least significant 1 itself is. These both cases are included in the count, because this sequence counts the total number of hitting digits, thus a(15)=2.
%o A276007 (Scheme)
%o A276007 (define (A276007 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))) (if (zero? d) (loop (+ 1 i) c) (loop (+ 1 i) (+ c (if (not (zero? (vector-ref fv (- i d)))) 1 0)))))))))
%o A276007 (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 A276007 Cf. A276005 (indices of zeros), A276006 (of nonzeros).
%Y A276007 Differs from A276004 for the first time at n=15, where a(15)=2, while A276004(15)=1.
%K A276007 nonn,base
%O A276007 0,10
%A A276007 _Antti Karttunen_, Aug 17 2016