OFFSET
1,1
COMMENTS
It appears that a(n) != -1 iff n in A056653.
LINKS
Michel Marcus, Table of n, a(n) for n = 1..10000
Peter Munn, Scatterplot with asinh-scale axes. (Axis labeled "A000027(n)" is n.)
EXAMPLE
In base 10, 12 is a term of A175252, and there is no other lesser base for which 12 works, so a(12) = 10.
PROG
(PARI) isok(k, b) = my(s=[]); fordiv(k, d, s=concat(s, digits(d, b)); if (fromdigits(s, b)==k, return(1)); if (fromdigits(s, b)> k, return(0)));
a(n) = if (n==1, 2, for (b=2, n-1, if (isok(n, b), return(b))); return(-1); );
(Python)
from sympy import divisors
from sympy.ntheory import digits
def ok(n, b):
target, s = digits(n, b)[1:], []
if target[0] != 1: return False
for d in divisors(n):
s += digits(d, b)[1:]
if len(s) >= len(target): return s == target
def a(n):
if n == 1: return 2
for b in range(2, n):
if ok(n, b): return b
return -1
print([a(n) for n in range(1, 76)]) # Michael S. Branicky, Oct 05 2022
CROSSREFS
KEYWORD
sign,base
AUTHOR
Michel Marcus, Sep 30 2022
STATUS
approved