A357777 a(1)=1, a(2)=2. Thereafter a(n+1) is the smallest k such that gcd(k, a(n)) > 1, and gcd(k, s(n)) = 1, where s(n) is the n-th partial sum.
1, 2, 4, 6, 3, 9, 12, 8, 14, 7, 35, 5, 15, 10, 16, 20, 18, 21, 27, 24, 22, 11, 33, 30, 25, 55, 40, 26, 13, 39, 36, 28, 32, 34, 17, 51, 45, 57, 19, 133, 38, 44, 46, 23, 69, 42, 48, 50, 52, 54, 56, 49, 63, 60, 58, 29, 87, 66, 62, 31, 93, 72, 64, 68, 70, 65, 75, 78
Offset: 1
Keywords
Examples
a(3) = 4 because 4 is the smallest number which has not occurred already which is prime to s(2)=3 and shares a divisor (2) with a(2)=2.
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..16384
- Michael De Vlieger, Log log scatterplot of a(n), n = 1..2^14, labeling records in red, local minima in blue, highlighting prime terms in green, prime partial sums in gold and labeling those in orange italics.
Programs
-
Mathematica
nn = 68; c[] = False; Array[Set[{a[#], c[#]}, {#, True}] &, 2]; u = s = 3; Do[j = a[n - 1]; k = u; If[CoprimeQ[j, s], While[Nand[! c[k], CoprimeQ[k, s], ! CoprimeQ[j, k], k != s], k++]]; Set[{a[n], c[k]}, {k, True}]; s += k; If[k == u, While[c[u], u++]], {n, 3, nn}]; Array[a, nn] (* _Michael De Vlieger, Oct 13 2022 *)
Comments