A376702 Numbers k whose nonzero digits are strictly decreasing when written in factoradic.
1, 2, 4, 5, 6, 12, 13, 14, 18, 19, 20, 22, 23, 24, 48, 49, 50, 54, 72, 73, 74, 76, 77, 78, 84, 85, 86, 96, 97, 98, 100, 101, 102, 108, 109, 110, 114, 115, 116, 118, 119, 120, 240, 241, 242, 246, 264, 360, 361, 362, 364, 365, 366, 372, 373, 374, 384, 408, 409, 410
Offset: 1
Examples
50, being 2010 (base !), is included, whereas 51, being 2011 (base !), is not included.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000
- Wikipedia, Factorial number system
Programs
-
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
-
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
Comments