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.

Showing 1-1 of 1 results.

A344887 a(n) is the least base k >= 2 that the base-k digits of n are nonincreasing.

Original entry on oeis.org

2, 2, 2, 2, 2, 4, 2, 2, 2, 3, 4, 5, 2, 3, 2, 2, 2, 5, 3, 6, 4, 3, 3, 5, 2, 3, 3, 3, 2, 7, 2, 2, 2, 6, 6, 6, 3, 4, 7, 3, 3, 4, 4, 6, 7, 7, 7, 7, 2, 7, 5, 8, 4, 4, 3, 5, 2, 4, 4, 8, 2, 4, 2, 2, 2, 9, 3, 3, 9, 9, 9, 10, 3, 8, 9, 3, 3, 9, 3, 3, 3, 3, 10, 10, 4, 4
Offset: 0

Views

Author

Rémy Sigrist, Jun 01 2021

Keywords

Examples

			For n = 258:
- we have:
     b  258 in base b  Nonincreasing?
     -  -------------  --------------
     2      100000010  No
     3         100120  No
     4          10002  No
     5           2013  No
     6           1110  Yes
- so a(258) = 6.
		

Crossrefs

Programs

  • Mathematica
    Table[k=1;While[AnyTrue[Differences@IntegerDigits[n,++k],#>0&]];k,{n,0,100}] (* Giorgos Kalogeropoulos, Jun 02 2021 *)
  • PARI
    a(n) = { for (b=2, oo, my (d=digits(n, b)); if (d==vecsort(d,,4), return (b))) }
    
  • Python
    # with library / without (faster for large n)
    from sympy.ntheory import digits
    def is_nondec(n, b): d = digits(n, b)[1:]; return d == sorted(d)[::-1]
    def is_nondec(n, b):
      if n < b: return True
      n, r = divmod(n, b)
      while n >= b:
        (n, r), lastd = divmod(n, b), r
        if r < lastd: return False
      return n >= r
    def a(n):
      for b in range(2, n+3):
        if is_nondec(n, b): return b
    print([a(n) for n in range(86)]) # Michael S. Branicky, Jun 01 2021

Formula

a(n) <= A000196(n) + 2.
a(n) <= 10 for any n in A009996.
a(n) = 2 iff n belongs to A023758.
Showing 1-1 of 1 results.