login
A375727
a(n) is the least number that is a Smith number in all bases 2 to n but not in base n+1.
0
15, 475, 1023, 222, 1924475, 26910204, 191999912, 240365505, 10127638898, 15357419170
OFFSET
2,1
EXAMPLE
a(3) = 475 = 5^2 * 19.
In base 2, 475 = 111011011_2 with digit sum 7, 5 = 101_2 with digit sum 2, 19 = 10011_2 with digit sum 3, and 7 = 2 * 2 + 3.
In base 3, 475 = 122121_3 with digit sum 9, 5 = 12_3 with digit sum 3, 19 = 201_3 with digit sum 3, and 9 = 2 * 3 + 3.
In base 4, 475 = 13123_4 with digit sum 10, 5 = 11_4 with digit sum 2, 19 = 103_4 with digit sum 4, and 10 <> 2 * 2 + 4.
MAPLE
f:= proc(n) local F, t, b;
if isprime(n) then return 0 fi;
F:= ifactors(n)[2];
for b from 2 while convert(convert(n, base, b), `+`) = add(t[2]*convert(convert(t[1], base, b), `+`), t = F) do od:
if b = 2 then 0 else b-1 fi
end proc:
N:= 7: # for a(2) .. a(N)
V:= Vector(N): count:= 0:
for n from 4 while count < N-1 do
v:= f(n);
if v > 0 and V[v] = 0 then V[v]:= n; count:= count+1 fi;
od:
convert(V[2..N], list);
PROG
(Python)
from sympy.ntheory import digits
from sympy import factorint, isprime
from itertools import count, islice
def sd(n, base=10): return sum(digits(n, base)[1:])
def f(n, factors):
for b in count(2):
if sd(n, base=b) != sum(sd(p, base=b)*factors[p] for p in factors):
break
return b-1
def agen(): # generator of terms
adict, n = dict(), 2
for k in count(1):
if isprime(k): continue
v = f(k, factorint(k))
if v not in adict: adict[v] = k
while n in adict: yield adict[n]; n += 1
print(list(islice(agen(), 4))) # Michael S. Branicky, Aug 25 2024
(PARI) smith(k) = {my(f = factor(k), p = f[, 1], e = f[, 2], b = 2); while(sumdigits(k, b) == sum(i = 1, #p, e[i] * sumdigits(p[i], b)), b++); b-1; }
lista(len) = {my(m = len + 1, v = vector(m), c = 0, i); forcomposite(k = 1, , i = smith(k); if(i <= m && v[i] == 0, c++; v[i] = k; if(c == m, break))); vecextract(v, "^1"); } \\ Amiram Eldar, Aug 29 2024
CROSSREFS
Sequence in context: A377498 A377497 A279922 * A129892 A275411 A289185
KEYWORD
nonn,base,more
AUTHOR
Robert Israel, Aug 25 2024
EXTENSIONS
a(8)-a(9) from Michael S. Branicky, Aug 26 2024
a(10)-a(11) from Amiram Eldar, Aug 29 2024
STATUS
approved