cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A376702 Numbers k whose nonzero digits are strictly decreasing when written in factoradic.

Original entry on oeis.org

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

Views

Author

Douglas Boffey, Oct 02 2024

Keywords

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.

Examples

			50, being 2010 (base !), is included, whereas 51, being 2011 (base !), is not included.
		

Crossrefs

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