A297345 a(0)=0; for n>0, a(n) is the least positive integer that cannot be represented as Sum_{k=1..n-1} a(i_k)*a(k), with 0 <= i_k < n.
0, 1, 2, 7, 24, 85, 285, 1143, 6268, 216784, 1059813, 6100794, 226303113
Offset: 0
Examples
a(1)= 1 since it is not possible to write 1 using only a(0). a(2)=2, since it is not possible to obtain 2 using only a(0) and a(1). The following numbers up to 6 can be represented using these first 3 elements of the sequence: 3 = 1*1 + 1*2, 4 = 0*1 + 2*2, 5 = 1*1 + 2*2, 6 = 2*1 + 2*2. Again we reach a number that cannot be represented as defined above, so that number is appended to the sequence. It happens here when we try to represent 7 using only a(0)=0, a(1)=1, and a(2)=2. So 7 becomes a(3). A larger example: 216752 = 1*1 + 1*2 + 85*7 + 285*24 + 85*85 + 85*285 + 24*1143 + 24*6268
Programs
-
Mathematica
Nest[Function[a, Append[a, 1 + LengthWhile[Differences@ #, # == 1 &] &@ Union[Total /@ Map[a # &, Tuples[a, Length@ a]]]]], {0}, 8] (* Michael De Vlieger, Jan 09 2018 *)
-
Python
# Generate all the elements in the sequence, S, necessary to represent all # numbers until the integer 'last'. It also shows how each integer is # represented by showing the sequence elements and the respective # multiplicative factors. import numpy as np import itertools last=100 def generate(i,S): n=len(S) s=np.asarray(S,dtype=np.int) perms = [p for p in itertools.product(S, repeat=n)] for iks in perms: t=np.asarray(iks) if np.dot(t,s) == i: print('%d=' %i, end=',') print(t,'x',s) return 0 return -1 S=[0] for i in range(1,last+1): if generate(i,S) == -1: S.append(i) generate(i,S)
Extensions
a(9) from Robert G. Wilson v, Jan 09 2018
a(10)-a(11) from Jon E. Schoenfield, Jan 16 2018
a(12) from Giovanni Resta, Jan 22 2018