login
a(n+1) = a(n) + gcd(a(n),a(n-2)), with a(1) = a(2) = a(3) = 1
1

%I #14 May 07 2023 14:04:35

%S 1,1,1,2,3,4,6,9,10,12,15,20,24,27,28,32,33,34,36,39,40,44,45,50,52,

%T 53,54,56,57,60,64,65,70,72,73,74,76,77,78,80,81,84,88,89,90,92,93,96,

%U 100,101,102,104,105,108,112,119,120,128,129,132

%N a(n+1) = a(n) + gcd(a(n),a(n-2)), with a(1) = a(2) = a(3) = 1

%C Adding gcd(a(n), a(n-1)) gives the natural numbers (with an extra 1).

%C Does every positive integer occur as a difference in this sequence? In the first 100000 terms, the maximum difference is 21, and only 14, 15, and 16 are missing up to 21.

%H Franklin T. Adams-Watters, <a href="/A260194/b260194.txt">Table of n, a(n) for n = 1..10000</a>

%t nxt[{a_,b_,c_}]:={b,c,c+GCD[c,a]}; NestList[nxt,{1,1,1},60][[;;,1]] (* _Harvey P. Dale_, May 07 2023 *)

%o (PARI) alist(n) = my(r=vector(n));r[1]=r[2]=r[3]=1;for(k=4,n,r[k]=r[k-1]+gcd(r[k-1],r[k-3]));r

%o (Magma) I:=[1,1,1]; [n le 3 select I[n] else Self(n-1) + Gcd(Self(n-1), Self(n-3)): n in [1..70]]; // _Vincenzo Librandi_, Jul 19 2015

%o (Haskell)

%o a260194 n = a260194_list !! (n-1)

%o a260194_list = 1 : 1 : 1 : f 1 1 1 where

%o f u v v' = w : f w u v where w = u + gcd u (u + v')

%o -- _Reinhard Zumkeller_, Jul 19 2015

%K nonn

%O 1,4

%A _Franklin T. Adams-Watters_, Jul 18 2015