A373390 a(n) = n for n <= 3; for n > 3, a(n) is the smallest unused positive number that is coprime to a(n-1) but has a common factor with at least one of a(1)...a(n-2).
1, 2, 3, 4, 9, 8, 15, 14, 5, 6, 7, 10, 21, 16, 25, 12, 35, 18, 49, 20, 27, 22, 39, 11, 13, 24, 55, 26, 33, 28, 45, 32, 51, 38, 17, 19, 30, 77, 34, 57, 40, 63, 44, 65, 36, 85, 42, 95, 46, 75, 23, 48, 91, 50, 69, 52, 81, 56, 87, 62, 29, 31, 54, 115, 58, 93, 64, 99, 68, 105, 74, 117, 37, 60, 119, 66
Offset: 1
Keywords
Examples
a(11) = 7 as 7 is coprime to a(10) = 6 while sharing a factor with a(8) = 14. This is the first term to differ from A098550. a(38) = 77 as 77 is coprime to a(37) = 30 while sharing a factor with a(30) = 28. This is the first term to differ from A247942.
Links
- Scott R. Shannon, Table of n, a(n) for n = 1..10000
- Scott R. Shannon, Image of the first 1000 terms. Numbers with one, two, three, or four and more distinct prime factors are shown as red, yellow, green and violet respectively. The white line is a(n) = n.
- Michael De Vlieger, Log log scatterplot of a(n), n = 1..2^16, showing primes in red, odd nonprimes in green, and composite even numbers in blue.
- Michael De Vlieger, Log log scatterplot of a(n), n = 1..2^14, showing primes in red, perfect prime powers in gold, squarefree composites in green, and numbers neither squarefree nor prime powers in blue and purple, with purple additionally indicating powerful numbers that are not prime powers.
- Michael De Vlieger, Table of n, a(n) for n = 1..131072
Crossrefs
Programs
-
Mathematica
c[] := False; p[] := False; nn = 120; Array[Set[{a[#], c[#], p[#]}, {#, True, True}] &, 3]; i = a[2]; j = a[3]; u = 4; Do[k = u; While[Or[c[k], ! CoprimeQ[j, k], NoneTrue[Set[s, #], p] &@FactorInteger[k][[All, 1]]], k++]; Map[Set[p[#], True] &, s]; Set[{a[n], c[k], i, j}, {k, True, j, k}]; If[k == u, While[c[u], u++]], {n, 4, nn}]; Array[a, nn] (* Michael De Vlieger, Jun 06 2024 *)
-
Python
from math import gcd, lcm from itertools import count, islice def agen(): # generator of terms yield from [1, 2, 3] aset, an, LCM, mink = {1, 2, 3}, 3, 6, 4 while True: an = next(k for k in count(mink) if k not in aset and gcd(k, an) == 1 and gcd(k, LCM) > 1) LCM = lcm(LCM, an) aset.add(an) while mink in aset: mink += 1 yield an print(list(islice(agen(), 76))) # Michael S. Branicky, Jun 18 2024
Comments