cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A122280 a(1) = 1, a(2) = 2; for n >= 3, a(n) = the smallest positive integer not occurring earlier in the sequence such that gcd(a(n-1), a(n)) is a prime.

This page as a plain text file.
%I A122280 #28 Oct 14 2022 08:55:41
%S A122280 1,2,4,6,3,9,12,10,5,15,18,8,14,7,21,24,22,11,33,27,30,16,26,13,39,36,
%T A122280 34,17,51,42,20,25,35,28,38,19,57,45,40,46,23,69,48,50,32,54,44,55,60,
%U A122280 58,29,87,63,49,56,62,31,93,66,52,65,70,64,74,37,111,72,75,78,68,82,41
%N A122280 a(1) = 1, a(2) = 2; for n >= 3, a(n) = the smallest positive integer not occurring earlier in the sequence such that gcd(a(n-1), a(n)) is a prime.
%H A122280 N. J. A. Sloane, <a href="/A122280/b122280.txt">Table of n, a(n) for n = 1..5002</a> [Computed using Ray Chandler's Mma program]
%t A122280 f[s_] := Block[{k = 1}, While[MemberQ[s, k] || ! PrimeQ[GCD[Last[s], k]], k++ ]; Append[s, k] ]; Nest[f, {1, 2}, 75] (* _Ray Chandler_, Aug 30 2006 *)
%o A122280 (Python)
%o A122280 from math import gcd
%o A122280 from sympy import isprime
%o A122280 from itertools import islice
%o A122280 def agen(): # generator of terms
%o A122280     aset, an, mink = {1, 2}, 2, 3
%o A122280     yield from sorted(aset)
%o A122280     while True:
%o A122280         k = mink
%o A122280         while k in aset or not isprime(gcd(an, k)): k += 1
%o A122280         an = k; aset.add(an); yield an
%o A122280         while mink in aset: mink += 1
%o A122280 print(list(islice(agen(), 72))) # _Michael S. Branicky_, Oct 13 2022
%Y A122280 Cf. A122281, A064413.
%K A122280 nonn
%O A122280 1,2
%A A122280 _Leroy Quet_, Aug 29 2006
%E A122280 Extended by _Ray Chandler_ and _Klaus Brockhaus_, Aug 30 2006