OFFSET
0,4
LINKS
EXAMPLE
a(10)=2 because you need 2 calculation steps to get to 10.
The numbers for the first calculation are: a(n-2)=a(8)=2, a(n-1)=a(9)=3.
We need to add these 2 numbers: 2+3=5 (1st step).
To get 10 as result we need to multiply 5 from step 1 with a(n) itself, so we get 5*2=10 (2nd step).
For n=34 we need 5 calculation steps, because there is no solution with 4 or fewer steps, but we pretend we tested these cases before.
The numbers we need to use {a(n-5) to a(n)} are: 5,3,5,4,3,5.
1. 5+3=8 | 2. 8*5=40 | 3. 40-4=36 | 4. 36+3=39 | 5. 39-5=34.
PROG
(Python)
def A(z):
a=[0, 1, 1]
n=3
an=2
while n<=z:
list1=[a[n-an]]
nn=an-2
while nn>0:
l=len(list1)
i=0
while i<l:
v=list1[0]
list1.remove(v)
list1.append(v+a[n-nn-1])
if v-n<300:
list1.append(v*a[n-nn-1])
list1.append(v-a[n-nn-1])
i=i+1
nn=nn-1
c=list1.count(n-an-a[n-1])+list1.count(n/an-a[n-1])+list1.count(n+an-a[n-1])
c=c+list1.count((n-an)/a[n-1])+list1.count((n/an)/a[n-1])+list1.count((n+an)/a[n-1])
c=c+list1.count(n-an+a[n-1])+list1.count(n/an+a[n-1])+list1.count(n+an+a[n-1])
if c==0:
an=an+1
else:
a.append(an)
print(n, an)
n=n+1
an=2
return a
CROSSREFS
KEYWORD
nonn
AUTHOR
S. Brunner, Oct 03 2019
STATUS
approved