[go: up one dir, main page]

login
Search: a276006 -id:a276006
     Sort: relevance | references | number | modified | created      Format: long | short | data
Numbers with hit-free factorial base representations; positions of zeros in A276004 & A276007.
+10
8
0, 1, 2, 4, 5, 6, 7, 12, 14, 16, 18, 19, 20, 22, 23, 24, 25, 26, 28, 29, 48, 49, 54, 55, 60, 66, 67, 72, 74, 76, 78, 84, 86, 88, 90, 92, 94, 96, 97, 98, 100, 101, 102, 103, 108, 110, 112, 114, 115, 116, 118, 119, 120, 121, 122, 124, 125, 126, 127, 132, 134, 136, 138, 139, 140, 142, 143, 240, 241, 242, 244, 245, 264, 265, 266, 268, 269, 288, 289, 312, 314, 316
OFFSET
0,3
COMMENTS
We say there is a "hit" in factorial base representation (A007623) of n when there is any such pair of nonzero digits d_i and d_j in positions i > j so that (i - d_i) = j. Here the rightmost (least significant digit) occurs at position 1. This sequence gives all "hit-free" numbers, meaning that for every nonzero digit d_i (in position i) in their factorial base representation the digit at the position (i - d_i) is 0.
Also numbers n for which A060502(n) = A060128(n), in other words, the numbers n for which the number of slopes in their factorial base representation (A007623) is equal to the number of non-singleton cycles of the permutation listed as n-th permutation in the list A060117 (or A060118).
This can be viewed as a factorial base analog of base-2 related A003714.
FORMULA
Other identities. For all n >= 1:
a(A000110(n)) = n! = A000142(n). [To be proved.]
EXAMPLE
n=14 (factorial base "210") is included because 2 occurs in position 3 and 1 occurs in position 2, thus as (3-2) = 1 <> 2, 2 does not "hit" digit 1.
n=15 ("211") is NOT included because 2 occurring in position 3 hits the rightmost 1 in position 1 (as 3-2 = 1), and moreover, also the middle 1 hits the rightmost 1 as 2-1 = 1.
PROG
(Scheme, with Antti Karttunen's IntSeq-library)
(define A276005 (ZERO-POS 0 0 A276004))
CROSSREFS
Complement: A276006.
Cf. A060112 (a subsequence).
Intersection with A275804 gives A261220.
Cf. also A003714, A060117 and A060118.
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Aug 17 2016
STATUS
approved
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).
+10
6
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, 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, 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
OFFSET
0,10
COMMENTS
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.
FORMULA
a(n) = A060502(n) - A060128(n).
a(n) = A000120(2*A275727(n) AND A276010(n)), where AND is a bitwise-and given in A004198.
EXAMPLE
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.
PROG
(Scheme, two variants)
(define (A276004 n) (- (A060502 n) (A060128 n)))
(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))))))))))
(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))))))
CROSSREFS
Cf. A276005 (indices of zeros), A276006 (of nonzeros).
Differs from A276007 for the first time at n=15, where a(15)=1, while A276004(15)=2.
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Aug 17 2016
STATUS
approved
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.
+10
5
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, 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, 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
OFFSET
0,10
COMMENTS
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.
EXAMPLE
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.
PROG
(Scheme)
(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)))))))))
(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))))))
CROSSREFS
Cf. A276005 (indices of zeros), A276006 (of nonzeros).
Differs from A276004 for the first time at n=15, where a(15)=2, while A276004(15)=1.
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Aug 17 2016
STATUS
approved

Search completed in 0.006 seconds