OFFSET
1,2
COMMENTS
Base factorial is defined as the right hand digit being the units, the next left being the 2's, then the 6's, and so on.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
Wikipedia, Factorial number system
EXAMPLE
50, being 2010 (base !), is included, whereas 51, being 2011 (base !), is not included.
PROG
(Python)
def f(n, i=2): return [n] if n < i else [*f(n//i, i=i+1), n%i]
def ok(n):
fnz = [d for d in f(n) if d != 0]
return len(fnz) == len(set(fnz)) and fnz == sorted(fnz, reverse=True)
print([k for k in range(1, 411) if ok(k)]) # Michael S. Branicky, Oct 02 2024
(Python) # faster for initial segment of sequence
from math import factorial
from itertools import count, islice
def bgen(d, i): # strictly decreasing non-zero elmts <= i and dth digit from left <= d
if d < 1: yield tuple(); return
yield from ((j, ) + t for j in range(0, min(i+1, d+1)) for t in bgen(d-1, i if j == 0 else j-1))
def agen(): # generator of terms
for digits in count(1):
for first in range(1, digits+1):
for rest in bgen(digits-1, first-1):
t = (first, ) + rest
yield sum(factorial(i)*d for i, d in enumerate(t[::-1], 1))
print(list(islice(agen(), 60))) # Michael S. Branicky, Oct 02 2024
(PARI) isok(n)={my(k=1, p=0); while(n, k++; my(r=n%k); if(r, if(r<=p, return(0)); p=r); n\=k); 1} \\ Andrew Howroyd, Oct 04 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Douglas Boffey, Oct 02 2024
STATUS
approved