A373623 a(n) = n for n <= 3; for n > 3, a(n) is the smallest unused positive number that shares a factor with the most recently appearing even number if a(n-1) is odd, otherwise it shares a factor with the most recently appearing odd number if a(n-1) is even.
1, 2, 3, 4, 6, 9, 8, 12, 15, 10, 5, 14, 20, 25, 16, 30, 35, 18, 7, 21, 22, 24, 27, 26, 33, 13, 28, 39, 32, 36, 42, 45, 34, 40, 48, 50, 51, 38, 17, 19, 44, 57, 11, 46, 55, 23, 52, 69, 54, 60, 63, 56, 49, 58, 70, 77, 62, 66, 84, 88, 91, 64, 65, 68, 75, 72, 78, 80, 81, 74, 87, 37, 76, 111, 82, 90, 93
Offset: 1
Keywords
Examples
a(5) = 6 as a(4) = 4 is even and the most recently appearing odd term is a(3) = 3, and 6 is the smallest unused positive number that shares a factor with 3. a(7) = 8 as a(6) = 9 is odd and the most recently appearing even term is a(5) = 6, and 8 is the smallest unused positive number that shares a factor with 6.
Links
- Scott R. Shannon, Table of n, a(n) for n = 1..10000
- 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, where the latter additionally represents powerful numbers.
- Scott R. Shannon, Image of the first 100000 terms. Numbers with one, two, three, four, or five and more prime factors, counted with multiplicity, are show as red, yellow, green, blue and violet respectively. The white line is a(n) = n.
- Scott R. Shannon, Image of the first 100000 terms. As above except here the colors show the number of distinct prime factors.
- Scott R. Shannon, Image of the first 100000 terms. The even terms are shown in red, the odd terms in yellow.
Programs
-
Mathematica
c[] := False; j = 3; nn = 120; q[] := 0; m[_] := 1; Array[Set[{a[#], c[#]}, {#, True}] &, j]; q[0] = 2; q[1] = 3; u = 5; Do[If[OddQ[j], If[PrimePowerQ[q[0]], k = m[2]; While[c[2 k], k++]; k *= 2; While[c[2 m[2]], m[2]++], k = u; While[Or[c[k], CoprimeQ[q[0], k]], k++]], If[PrimePowerQ[q[1]], (k = m[#]; While[c[k #], k++]; k *= #; While[c[# m[#]], m[#]++]) &[FactorInteger[q[1]][[1, 1]]], k = u; While[Or[c[k], CoprimeQ[q[1], k]], k++]] ]; q[Mod[j, 2]] = j; Set[{a[n], c[k], j}, {k, True, k}]; If[k == u, While[c[u], u++]], {n, j + 1, nn}]; Array[a, nn] (* Michael De Vlieger, Jun 20 2024 *)
Comments