Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #18 Jun 02 2021 16:17:47
%S 2,2,2,2,3,2,3,2,3,4,2,4,4,3,4,2,3,4,5,5,3,2,5,3,5,4,3,6,6,4,3,2,6,6,
%T 4,6,5,6,4,7,3,5,2,6,7,7,4,7,7,6,3,4,5,8,8,4,8,5,8,4,3,6,5,2,7,8,9,5,
%U 4,9,3,7,5,8,6,9,9,9,5,9,3,8,9,5,10,2,6
%N a(n) is the least base k >= 2 where n is an undulating number (i.e., with digits of the form abababab...).
%H Rémy Sigrist, <a href="/A344888/b344888.txt">Table of n, a(n) for n = 0..10000</a>
%F a(n) <= A000196(n) + 1 for any n > 0.
%F a(n) <= 10 for any n in A033619.
%F a(n) = 2 iff n belongs to A000225 or to A000975.
%e For n = 49:
%e - we have:
%e b 49 in base b Undulating?
%e - ------------ -----------
%e 2 110001 No
%e 3 1211 No
%e 4 301 No
%e 5 144 No
%e 6 121 Yes
%e - so a(49) = 6.
%o (PARI) is(n, base=10) = my (d=digits(n, base)); #d<=2 || d[1..#d-2]==d[3..#d]
%o a(n) = for (b=2, oo, if (is(n, b), return (b)))
%o (Python)
%o def A344888(n):
%o b, m = 2, n
%o while True:
%o m, x = divmod(m, b)
%o m, y = divmod(m, b)
%o while m > 0:
%o m, z = divmod(m,b)
%o if z != x:
%o break
%o if m > 0:
%o m, z = divmod(m,b)
%o if z != y:
%o break
%o else:
%o return b
%o else:
%o return b
%o b += 1
%o m = n # _Chai Wah Wu_, Jun 02 2021
%Y Cf. A000196, A000225, A000975, A033619.
%K nonn,look,base
%O 0,1
%A _Rémy Sigrist_, Jun 01 2021