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”).
%I #17 Jul 23 2024 02:42:47
%S 1,2,4,4,5,7,7,11,9,11,11,13,13,15,15,17,17,19,19,21,21,23,23,25,25,
%T 27,27,29,29,31,31,33,33,35,35,37,37,39,39,41,41,43,43,45,45,47,47,49,
%U 49,51,51,53,53,55,55,57,57,59,59,61,61,63,63,65,65,67,67,69,69,71,71,73
%N a(n) = smallest integer >= n which is coprime to A118000(n-1). a(n) = A118000(n) - A118000(n-1).
%p A118000 := proc(nmax) local a,n ; a := [0] ; while nops(a) < nmax do n := nops(a) ; while gcd(n,op(-1,a)) <> 1 do n := n+1 ; od ; a := [op(a), op(-1,a)+n] ; od ; RETURN(a) ; end: a118000 := A118000(100) : for n from 1 to nops(a118000)-1 do printf("%d, ",op(n+1,a118000)- op(n,a118000)) ; od ; # _R. J. Mathar_, Jun 06 2007
%t A118000[n_] := A118000[n] = If[n == 0, 0, Module[{a1 = A118000[n-1], k}, For[k = n, True, k++, If[CoprimeQ[a1, k], Return[a1+k]]]]];
%t a[n_] := A118000[n] - A118000[n-1];
%t Table[a[n], {n, 1, 72}] (* _Jean-François Alcover_, Apr 08 2024 *)
%Y Cf. A118000, A118003.
%K nonn
%O 1,2
%A _Leroy Quet_, Apr 09 2006
%E Corrected and extended by _R. J. Mathar_, Jun 06 2007