%I #20 May 05 2021 13:41:07
%S 5,1,16,12,49,58,60,110,209,117,240,430,255,1423,921,980,511,1847,
%T 3737,3692,3998,7265,15267,15651,15722,31457,32659,64248,57927,64448,
%U 64171,250068,129013,501578,256159,510732,980930,979883
%N In binary representation: least number, k, which occurs n times in its factorial.
%C Overlapping occurrences are counted. - _Michael S. Branicky_, May 01 2021
%C a(47) = 262143. - _Michael S. Branicky_, May 02 2021
%e 12!_b = 11100100011001111110000000000 and 12_b = 1100 and the later string appears thrice in the former string.
%t f[n_] := ToString[ FromDigits[ IntegerDigits[n, 2]]]; g[n_] := Length[ StringPosition[ f[n! ], f[n]]]; a = Table[0, {30}]; Do[ b = g[n]; If[a[[b + 1]] == 0, a[[b + 1]] = n], {n, 29000}]; a
%o (Python)
%o from itertools import count, takewhile
%o def count_overlaps(subs, s):
%o c = i = 0
%o while i != -1:
%o i = s.find(subs, i)
%o if i != -1: c += 1; i += 1
%o return c
%o def afind(limit):
%o kfact, adict = 1, dict()
%o for k in range(1, limit+1):
%o kb, kfact = bin(k)[2:], kfact * k
%o kfactb = bin(kfact)[2:]
%o n = count_overlaps(kb, kfactb)
%o if n not in adict: adict[n] = k
%o return [adict[n] for n in takewhile(lambda i: i in adict, count(0))]
%o print(afind(16000)) # _Michael S. Branicky_, May 01 2021
%Y Cf. A093685.
%K nonn,base
%O 0,1
%A _Robert G. Wilson v_ and _Reinhard Zumkeller_, Apr 16 2004
%E a(25)-a(37) from _Michael S. Branicky_, May 03 2021
|