login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A138244 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
1, 2, 5, 7, 11, 17, 25, 37, 47, 61, 79, 101, 127, 151, 167, 197, 229, 257, 277, 311, 347, 389, 433, 479, 541, 593, 631, 691, 739, 797, 853, 907, 947, 997, 1061, 1129, 1201, 1277, 1361, 1427, 1517, 1597, 1667, 1741, 1823, 1901, 1987, 2081, 2179, 2267, 2371 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
a(n+1) - a(n) = A138245(n).
LINKS
Michel Marcus, Table of n, a(n) for n = 1..10000 (terms 1..1000 from Joshua Zucker, Mar 09 2008)
MATHEMATICA
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 *)
PROG
(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); }
findnext(dlist, last, n) = {my(k=last+1); while (!isok(dlist, last, k), k++); k; }
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
(Python)
from math import gcd
from itertools import count, islice
def agen(): # generator of terms
yield from [1, 2]
anm1, an, diffs, mind = 1, 2, {1}, 2
while True:
anm1, an = an, max(an+1, mind)
while an-anm1 in diffs or gcd(an, an-anm1) != 1 or any(gcd(an, dk) != 1 for dk in diffs):
an += 1
diffs.add(an - anm1)
while mind in diffs: mind += 1
yield an
print(list(islice(agen(), 51))) # Michael S. Branicky, Jan 28 2023
CROSSREFS
Cf. A138245.
Sequence in context: A062044 A077128 A106008 * A326505 A019396 A153767
KEYWORD
nonn
AUTHOR
Leroy Quet, Mar 08 2008
EXTENSIONS
More terms from Joshua Zucker, Mar 09 2008
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 13:10 EDT 2024. Contains 371780 sequences. (Running on oeis4.)