login
Numbers that have at least one 1-digit in their factorial base representation (A007623).
36

%I #48 Apr 30 2020 13:36:23

%S 1,2,3,5,6,7,8,9,10,11,13,14,15,17,19,20,21,23,24,25,26,27,28,29,30,

%T 31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,49,50,51,53,54,55,

%U 56,57,58,59,61,62,63,65,67,68,69,71,73,74,75,77,78,79,80,81,82,83,85,86,87,89,91,92,93,95,97,98,99,101

%N Numbers that have at least one 1-digit in their factorial base representation (A007623).

%C Numbers n for which A257679(n) = 1, i.e., numbers n such that the least nonzero digit in their factorial base representation (A007623) is 1.

%C Involution A225901 maps each term of this sequence to a unique term of A273670, and vice versa.

%C Starting offset is zero (with a(0) = 1) because it is the most natural offset for the given fast recurrence.

%H Antti Karttunen, <a href="/A256450/b256450.txt">Table of n, a(n) for n = 0..10000</a>

%H <a href="/index/Fa#facbase">Index entries for sequences related to factorial base representation</a>

%F a(0) = 1, and for n >= 1, if A257511(1+a(n-1)) > 0, then a(n) = a(n-1) + 1, otherwise a(n-1) + 2. [In particular, if the previous term is 2k, then the next term is 2k+1, because all odd numbers are members.]

%F Other identities:

%F For all n >= 0, A273662(a(n)) = n. [A273662 works as the left inverse for this sequence.]

%F From _Antti Karttunen_, May 26 2015: (Start)

%F Alternative recurrence for the same sequence:

%F Set k = A258198(n), d = n - A258199(n) and f = A000142(k+1) = (k+1)! If d < f then b(n) = f+d, otherwise b(n) = ((2+floor((d-f)/A258199(n))) * f) + b((d-f) mod A258199(n)). For offset=1 sequence, define a(n) = b(n-1).

%F (End)

%t Select[Range@ 101, MemberQ[IntegerDigits[#, MixedRadix[Reverse@ Range@ 12]], 1] &] (* _Michael De Vlieger_, May 30 2016, Version 10.2 *)

%t r = MixedRadix[Reverse@ Range[2, 12]]; Select[Range@ 101, Min[IntegerDigits[#, r] /. 0 -> Nothing] == 1 &] (* _Michael De Vlieger_, Aug 14 2016, Version 10.2 *)

%o (Scheme, with _Antti Karttunen_'s IntSeq-library)

%o (define A256450 (NONZERO-POS 0 0 A257680))

%o ;; Alternatively, as a naive recurrence:

%o (definec (A256450 n) (if (zero? n) 1 (let ((prev (A256450 (- n 1)))) (cond ((even? prev) (+ 1 prev)) ((> (A257511 (+ 1 prev)) 0) (+ 1 prev)) (else (+ 2 prev))))))

%o ;; Faster recurrence May 26 2015:

%o (definec (A256450 n) (let* ((k (A258198 n)) (d (- n (A258199 n))) (f (A000142 (+ 1 k)))) (cond ((< d f) (+ f d)) (else (+ (* f (+ 2 (floor->exact (/ (- d f) (A258199 n))))) (A256450 (modulo (- d f) (A258199 n))))))))

%o (Python)

%o def A(n, p=2): return n if n<p else A(n//p, p+1)*10 + n%p

%o print([n for n in range(1, 151) if str(A(n)).count("1")>=1]) # _Indranil Ghosh_, Jun 19 2017

%Y Cf. A007623, A257679.

%Y Complement of A255411.

%Y Cf. A257680 (characteristic function), A273662 (left inverse).

%Y First row of A257503, first column of A257505.

%Y Subsequences: A059590 (apart from its zero-term), A255341, A255342, A255343, A257262, A257263, A258198, A258199.

%Y Cf. also A227187 (numbers with at least one nonleading zero) and A273670, A225901.

%K nonn,base

%O 0,2

%A _Antti Karttunen_, Apr 27 2015

%E Starting offset changed from 1 to 0 by _Antti Karttunen_, May 30 2016