login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(1)=1; for n>1, a(n) = smallest integer > a(n-1) such that a(n) is coprime to (a(k) - a(k-1)) for all k, 2 <= k <= n and such that (a(n) - a(n-1)) doesn't equal (a(k) - a(k-1)) for any k, 2 <= k <= n-1.
3

%I #23 Jan 28 2023 12:11:42

%S 1,2,5,7,11,17,25,37,47,61,79,101,127,151,167,197,229,257,277,311,347,

%T 389,433,479,541,593,631,691,739,797,853,907,947,997,1061,1129,1201,

%U 1277,1361,1427,1517,1597,1667,1741,1823,1901,1987,2081,2179,2267,2371

%N a(1)=1; for n>1, a(n) = smallest integer > a(n-1) such that a(n) is coprime to (a(k) - a(k-1)) for all k, 2 <= k <= n and such that (a(n) - a(n-1)) doesn't equal (a(k) - a(k-1)) for any k, 2 <= k <= n-1.

%C a(n+1) - a(n) = A138245(n).

%H Michel Marcus, <a href="/A138244/b138244.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..1000 from Joshua Zucker, Mar 09 2008)

%t a[1] = 1; a[n_] := a[n] = Module[{m = a[n - 1] + 1}, While[MemberQ[(t = Table[a[k] - a[k - 1], {k, 2, n - 1}]), m - a[n - 1]] || ! CoprimeQ[m, m - a[n - 1]] || !AllTrue[t, CoprimeQ[m, #] &], m++]; m]; Array[a, 50] (* _Amiram Eldar_, Nov 16 2021 *)

%o (PARI) isok(dlist, last, k) = {if (gcd(k, k-last) != 1, return (0)); for (i=1, #dlist, if (gcd(k, dlist[i]) != 1, return(0)); if ((k-last) == dlist[i], return(0));); return(1);}

%o findnext(dlist, last, n) = {my(k=last+1); while (!isok(dlist, last, k), k++); k;}

%o lista(nn) = {my(list=List(), dlist=List()); listput(list, 1); for (n=2, nn, my(x=findnext(dlist, list[n-1], n)); listput(dlist, x-list[n-1]); listput(list, x);); Vec(list);} \\ _Michel Marcus_, Nov 16 2021

%o (Python)

%o from math import gcd

%o from itertools import count, islice

%o def agen(): # generator of terms

%o yield from [1, 2]

%o anm1, an, diffs, mind = 1, 2, {1}, 2

%o while True:

%o anm1, an = an, max(an+1, mind)

%o while an-anm1 in diffs or gcd(an, an-anm1) != 1 or any(gcd(an, dk) != 1 for dk in diffs):

%o an += 1

%o diffs.add(an - anm1)

%o while mind in diffs: mind += 1

%o yield an

%o print(list(islice(agen(), 51))) # _Michael S. Branicky_, Jan 28 2023

%Y Cf. A138245.

%K nonn

%O 1,2

%A _Leroy Quet_, Mar 08 2008

%E More terms from _Joshua Zucker_, Mar 09 2008