OFFSET
0,3
COMMENTS
The sequence increases rapidly after n = 92.
From roughly n = 480 to n = 600, the sequence increases relatively fast and is almost a perfect exponential function.
Redefining a(0) and a(1) can result in drastically different sequences.
LINKS
Harvey P. Dale, Table of n, a(n) for n = 0..1000
FORMULA
a(0) = a(1) = 1; for n > 1, a(n) = (a(n-1) + a(n-2)) / gcd(a(n-1), a(n-2)) if gcd(a(n-1), a(n-2)) > 1, otherwise a(n) = a(n-1) + a(n-2) + 1.
MATHEMATICA
a[0]=a[1]=1; a[n_] := a[n] = Block[{g = GCD[a[n-1], a[n-2]]}, If[g==1,
a[n-1] + a[n-2] + 1, (a[n-1] + a[n-2])/g]]; Array[a, 67, 0] (* Giovanni Resta, Sep 19 2019 *)
nxt[{a_, b_}]:={b, If[!CoprimeQ[a, b], (a+b)/GCD[a, b], a+b+1]}; NestList[nxt, {1, 1}, 70][[;; , 1]] (* Harvey P. Dale, Feb 14 2024 *)
PROG
(Python)
import math
def a(n): # Iteratively generates an array containing the first n terms of a(n), n should be greater than 2
a1 = 1 # this will hold a(n-1), its initial value is a(1)
a2 = 1 # this will hold a(n-2), its initial value is a(0)
terms = [None] * n
terms[0] = a2
terms[1] = a1
for i in range(2, n):
gcdPrev2 = math.gcd(a1, a2)
if(gcdPrev2 > 1):
terms[i] = int((a1 + a2) / gcdPrev2)
else:
terms[i] = a1 + a2 + 1
a2 = a1
a1 = terms[i]
return terms
(Magma) a:=[1, 1]; for n in [3..67] do if Gcd(a[n-1], a[n-2]) ne 1 then Append(~a, (a[n-1]+a[n-2])/Gcd(a[n-1], a[n-2])); else Append(~a, a[n-1]+a[n-2]+1); end if; end for; a; // Marius A. Burtea, Sep 19 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Ian Band, Sep 16 2019
STATUS
approved