login
a(n) = gcd(b(n-1)+1, b(n)), where b is A347113.
2

%I #25 May 06 2022 09:51:33

%S 2,5,11,23,47,5,2,3,7,3,4,3,13,9,5,2,19,13,7,8,17,5,3,5,31,21,11,3,4,

%T 3,37,25,2,29,59,17,3,2,41,83,167,5,3,2,43,29,2,3,7,19,5,23,2,3,5,61,

%U 41,7,2,53,107,43,11,7,2,67,3,4,5,71,13,3,2,3,73,3,5,2,79,53,2,7

%N a(n) = gcd(b(n-1)+1, b(n)), where b is A347113.

%C The definition of A347113 forbids a(n) to be 1.

%H Michel Marcus, <a href="/A347309/b347309.txt">Table of n, a(n) for n = 2..10000</a> (terms 2..1000 from N. J. A. Sloane)

%p b:= proc() true end:

%p g:= proc(n) option remember; local j, k; j:= g(n-1)+1;

%p for k from 2 do if b(k) and k<>j and igcd(k, j)>1

%p then b(k):= false; return k fi od

%p end: g(1):= 1:

%p a:= n-> igcd(g(n-1)+1, g(n)):

%p seq(a(n), n=2..100); # _Alois P. Heinz_, Sep 02 2021

%t b[_] = True;

%t g[n_] := g[n] = Module[{j = g[n - 1] + 1, k},

%t For[k = 2, True, k++, If[ b[k] && k != j && GCD[k, j] > 1,

%t b[k] = False; Return[k]]]];

%t g[1] = 1;

%t a[n_] := GCD[g[n - 1] + 1, g[n]];

%t Table[a[n], {n, 2, 100}] (* _Jean-François Alcover_, May 06 2022, after _Alois P. Heinz_ *)

%Y Cf. A347113.

%K nonn

%O 2,1

%A _N. J. A. Sloane_, Sep 01 2021