A351987 Numbers with factorial base expansion digits in nonincreasing order.
0, 1, 2, 3, 4, 5, 6, 8, 9, 12, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 30, 32, 33, 48, 54, 56, 57, 60, 62, 63, 64, 65, 72, 78, 80, 81, 84, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 102, 104, 105, 108, 110, 111, 112, 113, 114, 116, 117, 118, 119, 120, 144, 150
Offset: 1
Examples
The factorial base expansion of 102 is "4100", so 102 belongs to this sequence. The factorial base expansion of 103 is "4101", so 103 does not belong to this sequence.
Links
- Rémy Sigrist, Table of n, a(n) for n = 1..6910 (terms <= 9!)
- Index entries for sequences related to factorial base representation
Programs
-
Mathematica
max = 6; q[n_] := AllTrue[Differences @ IntegerDigits[n, MixedRadix[Range[max, 2, -1]]], # <= 0 &]; Select[Range[0, max!], q] (* Amiram Eldar, Feb 28 2022 *)
-
PARI
is(n) = { my (p=0); for (r=2, oo, if (n==0, return (1)); my (d=n%r); if (d
-
Python
def facbase(n, i=2): return [n] if n < i else [*facbase(n//i, i=i+1), n%i] def ok(n): return (fb:=facbase(n)) == sorted(fb, reverse=True) print([k for k in range(151) if ok(k)]) # Michael S. Branicky, Mar 09 2025
-
Python
# faster for initial segment of sequence from math import factorial from itertools import count, islice, product def bgen(d, first, last): # generator of non-increasing factorial base tuples yield from ((i,) + t for i in range(first, last+1) for t in bgen(d-1, first=0, last=min(i, d-1))) if d else (tuple(),) def A351987_gen(): # generator of terms yield from (sum(dj*factorial(j) for j, dj in enumerate(t[::-1], 1)) for d in count(0) for t in bgen(d, 1, d)) print(list(islice(A351987_gen(), 63))) # Michael S. Branicky, Mar 09 2025
Comments