login
Numbers with at least one maximal digit in their factorial base representation.
40

%I #25 Apr 30 2020 13:35:47

%S 1,3,4,5,7,9,10,11,13,15,16,17,18,19,20,21,22,23,25,27,28,29,31,33,34,

%T 35,37,39,40,41,42,43,44,45,46,47,49,51,52,53,55,57,58,59,61,63,64,65,

%U 66,67,68,69,70,71,73,75,76,77,79,81,82,83,85,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105

%N Numbers with at least one maximal digit in their factorial base representation.

%C Indexing starts from 0 (with a(0) = 1) to tally with the indexing used in A256450.

%C Numbers n for which is A260736(n) > 0.

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

%H Antti Karttunen, <a href="/A273670/b273670.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 A260736(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. For all n >= 0:

%F A273663(a(n)) = n.

%t r = MixedRadix[Reverse@ Range[2, 12]]; Select[Range@ 105, Total@ Boole@ Map[SameQ @@ # &, Transpose@{#, Range@ Length@ #}] > 0 &@ Reverse@ IntegerDigits[#, r] &] (* _Michael De Vlieger_, Aug 14 2016, Version 10.2 *)

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

%o (define A273670 (NONZERO-POS 0 0 A260736))

%o ;; Or as a naive recurrence with memoization-macro definec:

%o (definec (A273670 n) (if (zero? n) 1 (let ((prev (A273670 (- n 1)))) (cond ((even? prev) (+ 1 prev)) ((not (zero? (A260736 (+ 1 prev)))) (+ 1 prev)) (else (+ 2 prev))))))

%o (Python)

%o from sympy import factorial as f

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

%o def a257684(n):

%o x=str(a007623(n))[:-1]

%o y="".join([str(int(i) - 1) if int(i)>0 else '0' for i in x])[::-1]

%o return 0 if n==1 else sum([int(y[i])*f(i + 1) for i in range(len(y))])

%o def a260736(n): return 0 if n==0 else n%2 + a260736(a257684(n))

%o print([n for n in range(106) if a260736(n)>0]) # _Indranil Ghosh_, Jun 20 2017

%Y Cf. A153880 (complement).

%Y Cf. A273663 (a left inverse).

%Y Cf. A260736.

%Y Cf. also A225901, A256450.

%K nonn,base

%O 0,2

%A _Antti Karttunen_, May 29 2016