OFFSET
1,1
COMMENTS
LINKS
Ely Golden, Table of n, a(n) for n = 1..1889
PROG
(SageMath)
def nonZeroDigits(x, n):
if(x<=0|n<2):
return []
li=[]
while(x>0):
d=divmod(x, n)
if(d[1]!=0):
li.append(d[1])
x=d[0]
li.sort()
return li;
def nonZeroFactorDigits(x, n):
if(x<=0|n<2):
return []
li=[]
f=list(factor(x))
#ensures inequality of nonZeroFactorDigits(x, n) and nonZeroDigits(x, n) if x is prime
if((len(f)==1)&(f[0][1]==1)):
return [];
for c in range(len(f)):
for d in range(f[c][1]):
ld=nonZeroDigits(f[c][0], n)
li+=ld
li.sort()
return li;
#the actual function
def a(n):
c=n**2+n+1
limit=2*(n**2)
if(n%2!=0):
return -1
while((nonZeroFactorDigits(c, n)!=nonZeroDigits(c, n))&(c<limit)):
c+=1;
if(c>=limit):
return -1
return c;
index=1
value=2
while(index<=1000):
result=a(value)
if(result!=-1):
print(str(index)+" "+str(value)+" "+str(result))
index+=1
value+=1
print("complete")
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Ely Golden, Dec 30 2016
STATUS
approved