login
a(n) = number of occurrences of a most frequent nonzero digit in factorial base representation (A007623) of n.
9

%I #31 Jan 24 2024 01:50:04

%S 0,1,1,2,1,1,1,2,2,3,1,2,1,1,1,2,2,2,1,1,1,2,1,1,1,2,2,3,1,2,2,3,3,4,

%T 2,3,1,2,2,3,2,2,1,2,2,3,1,2,1,1,1,2,2,2,1,2,2,3,2,2,2,2,2,2,3,3,1,1,

%U 1,2,2,2,1,1,1,2,1,1,1,2,2,3,1,2,1,1,1,2,2,2,2,2,2,2,2,2,1,1,1,2,1,1,1,2,2,3,1,2,1,1,1,2,2,2,1,1,1,2,1,1,1,2

%N a(n) = number of occurrences of a most frequent nonzero digit in factorial base representation (A007623) of n.

%H Antti Karttunen, <a href="/A264990/b264990.txt">Table of n, a(n) for n = 0..10080</a>

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

%F a(0) = 0; for n >= 1, a(n) = max(A257511(n), a(A257684(n)).

%F Other identities. For all n >= 0:

%F From _Antti Karttunen_, Aug 15 2016: (Start)

%F a(n) = A275811(A225901(n)).

%F a(n) = A051903(A275735(n)).

%F (End)

%e n A007623(n) a(n) [highest number of times any nonzero digit occurs].

%e 0 = 0 0 (because no nonzero digits present)

%e 1 = 1 1

%e 2 = 10 1

%e 3 = 11 2

%e 4 = 20 1

%e 5 = 21 1

%e 6 = 100 1

%e 7 = 101 2

%e 8 = 110 2

%e 9 = 111 3

%e 10 = 120 1

%e 11 = 121 2

%e 12 = 200 1

%e 13 = 201 1

%e 14 = 210 1

%e 15 = 211 2

%e 16 = 220 2

%e 17 = 221 2

%e 18 = 300 1

%e and for n=63 we have:

%e 63 = 2211 2.

%t a[n_] := Module[{k = n, m = 2, r, s = {}}, While[{k, r} = QuotientRemainder[k, m]; k != 0|| r != 0, AppendTo[s, r]; m++]; Max[Tally[Select[s, # > 0 &]][[;;,2]]]]; a[0] = 0; Array[a, 100, 0] (* _Amiram Eldar_, Jan 24 2024 *)

%o (Scheme with memoization-macro definec)

%o (definec (A264990 n) (if (zero? n) n (max (A257511 n) (A264990 (A257684 n)))))

%o (Python)

%o from sympy import prime, factorint

%o from operator import mul

%o import collections

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

%o def a051903(n): return 0 if n==1 else max(factorint(n).values())

%o def a275735(n):

%o y=collections.Counter(map(int, list(str(a007623(n)).replace("0", "")))).most_common()

%o return 1 if n==0 else reduce(mul, [prime(y[i][0])**y[i][1] for i in range(len(y))])

%o def a(n): return 0 if n==0 else a051903(a275735(n))

%o print([a(n) for n in range(201)]) # _Indranil Ghosh_, Jun 20 2017

%Y Cf. A007623, A051903, A225901, A257511, A257684, A275735, A275811.

%Y Cf. A265349 (positions of terms <= 1), A265350 (positions of term > 1).

%Y Cf. also A266117, A266118.

%K nonn,base

%O 0,4

%A _Antti Karttunen_, Dec 22 2015

%E Name changed by _Antti Karttunen_, Aug 15 2016