login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A344887
a(n) is the least base k >= 2 that the base-k digits of n are nonincreasing.
1
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,1
LINKS
FORMULA
a(n) <= A000196(n) + 2.
a(n) <= 10 for any n in A009996.
a(n) = 2 iff n belongs to A023758.
EXAMPLE
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.
MATHEMATICA
Table[k=1; While[AnyTrue[Differences@IntegerDigits[n, ++k], #>0&]]; k, {n, 0, 100}] (* Giorgos Kalogeropoulos, Jun 02 2021 *)
PROG
(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
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jun 01 2021
STATUS
approved