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.

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

This page as a plain text file.
%I A344887 #13 Jun 02 2021 22:14:07
%S A344887 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,
%T A344887 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,
%U A344887 9,9,9,10,3,8,9,3,3,9,3,3,3,3,10,10,4,4
%N A344887 a(n) is the least base k >= 2 that the base-k digits of n are nonincreasing.
%H A344887 Rémy Sigrist, <a href="/A344887/b344887.txt">Table of n, a(n) for n = 0..10000</a>
%F A344887 a(n) <= A000196(n) + 2.
%F A344887 a(n) <= 10 for any n in A009996.
%F A344887 a(n) = 2 iff n belongs to A023758.
%e A344887 For n = 258:
%e A344887 - we have:
%e A344887      b  258 in base b  Nonincreasing?
%e A344887      -  -------------  --------------
%e A344887      2      100000010  No
%e A344887      3         100120  No
%e A344887      4          10002  No
%e A344887      5           2013  No
%e A344887      6           1110  Yes
%e A344887 - so a(258) = 6.
%t A344887 Table[k=1;While[AnyTrue[Differences@IntegerDigits[n,++k],#>0&]];k,{n,0,100}] (* _Giorgos Kalogeropoulos_, Jun 02 2021 *)
%o A344887 (PARI) a(n) = { for (b=2, oo, my (d=digits(n, b)); if (d==vecsort(d,,4), return (b))) }
%o A344887 (Python) # with library / without (faster for large n)
%o A344887 from sympy.ntheory import digits
%o A344887 def is_nondec(n, b): d = digits(n, b)[1:]; return d == sorted(d)[::-1]
%o A344887 def is_nondec(n, b):
%o A344887   if n < b: return True
%o A344887   n, r = divmod(n, b)
%o A344887   while n >= b:
%o A344887     (n, r), lastd = divmod(n, b), r
%o A344887     if r < lastd: return False
%o A344887   return n >= r
%o A344887 def a(n):
%o A344887   for b in range(2, n+3):
%o A344887     if is_nondec(n, b): return b
%o A344887 print([a(n) for n in range(86)]) # _Michael S. Branicky_, Jun 01 2021
%Y A344887 Cf. A000196, A009996, A023758, A273040.
%K A344887 nonn,base
%O A344887 0,1
%A A344887 _Rémy Sigrist_, Jun 01 2021