login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A333111
a(n) is the least positive integer not used earlier such that n+1 and the sum of terms up to a(n) are coprime.
0
1, 3, 5, 2, 6, 7, 9, 4, 10, 11, 13, 8, 14, 16, 12, 17, 19, 15, 21, 18, 22, 23, 25, 20, 26, 28, 24, 29, 31, 27, 33, 30, 34, 35, 37, 32, 38, 40, 36, 41, 43, 39, 45, 42, 46, 47, 49, 44, 50, 52, 48, 53, 55, 51, 57, 54, 58, 59, 63, 56, 60, 61, 65, 62, 66, 67
OFFSET
1,2
COMMENTS
Conjectured to be a permutation of the positive integers.
EXAMPLE
We start with a(1) = 1. To find a(2), we need the earliest positive integer such that a(1) + a(2) is coprime to 3. So, a(2) = 3. To find a(3), we can use neither 2 nor 4, because 6 and 8 have a common factor with 4, so we use a(3) = 5.
PROG
(PARI) A333111_vec(N, a=Vec(1, N), s=1, u=1)={ for(n=2, N, u+=1<<a[n-1]; for(k=valuation(u+1, 2), oo, bittest(u, k) || gcd(s+k, n+1)>1 || [s+=a[n]=k, break])); a}
CROSSREFS
Sequence in context: A372143 A302793 A010782 * A139584 A064790 A113966
KEYWORD
nonn
AUTHOR
Ali Sada and M. F. Hasler, Mar 07 2020
STATUS
approved