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”).

a(n) = smallest positive integer not occurring earlier in the sequence such that Sum_{k=1..n} a(k) is coprime to n.
3

%I #19 Sep 30 2017 23:59:20

%S 1,2,4,6,3,7,8,10,5,11,12,14,9,15,17,13,18,20,16,22,19,23,24,26,21,27,

%T 29,25,30,32,28,34,31,35,36,38,33,39,41,37,42,44,40,46,43,47,48,50,45,

%U 51,53,49,54,56,52,58,55,59,60,64,57,61,62,66,63,67,68,70,65,71,72,74

%N a(n) = smallest positive integer not occurring earlier in the sequence such that Sum_{k=1..n} a(k) is coprime to n.

%C Sequence is likely to be a permutation of the positive integers, but I am uncertain. A117533(n) = Sum_{k=1..n} a(k). Sequence A117534 is the inverse permutation if this sequence is a permutation of the positive integers.

%H Michael De Vlieger, <a href="/A117532/b117532.txt">Table of n, a(n) for n = 1..3000</a>

%e a(4) = 6 because 6 is the smallest positive integer m not among the first 3 terms of the sequence such that 1+2+4+m is coprime to 4. 1+2+4+3 = 10 and gcd(4,10)=2; 1+2+4+5 = 12 and gcd(4,12)=4; but 1+2+4+6 = 13 and gcd(4,13)=1.

%p A117532 := proc(nmax) local a,n,nxt, asu ; a := [1] ; asu := 1 ; while nops(a) < nmax do n := nops(a)+1 ; nxt := 1 ; while nxt in a or gcd(n, asu+nxt) <> 1 do nxt := nxt+1 ; od ; a := [op(a),nxt] ; asu := asu+nxt ; od ; a ; end: A117532(80) ; # _R. J. Mathar_, May 10 2007

%t Fold[Append[#1, Block[{k = 2}, While[Nand[FreeQ[#1, k], CoprimeQ[Total@ #1 + k, #2]], k++]; k]] &, {1}, Range[2, 72]] (* _Michael De Vlieger_, Sep 30 2017 *)

%Y Cf. A117534, A117533.

%K nonn

%O 1,2

%A _Leroy Quet_, Mar 26 2006

%E More terms from _R. J. Mathar_, May 10 2007