OFFSET
1,2
COMMENTS
Conjectured to be a permutation of the positive integers.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
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.
MAPLE
N:= 1000: # for terms until the first term > N
R:= 1: Cands:= [$2..N]: s:= 1:
for n from 2 do
found:= false;
for j from 1 to N-n+1 do
if igcd(n+1, s+Cands[j]) = 1 then
R:= R, Cands[j]; s:= s + Cands[j]; Cands:= subsop(j=NULL, Cands); found:= true; break
fi
od;
if not found then break fi
od:
R; # Robert Israel, Feb 13 2026
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
KEYWORD
nonn
AUTHOR
Ali Sada and M. F. Hasler, Mar 07 2020
STATUS
approved
