|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,1
|
|
LINKS
|
|
|
FORMULA
|
|
|
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
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|