|
|
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
|
|
|
|
OFFSET
|
2,1
|
|
LINKS
|
|
|
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
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,more,new
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|