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

A138308
a(1)=1. a(n) = smallest integer > a(n-1) that is coprime to n and is coprime to every (nonzero) exponent in the prime factorization of n.
3
1, 3, 4, 5, 6, 7, 8, 11, 13, 17, 18, 19, 20, 23, 26, 27, 28, 29, 30, 31, 32, 35, 36, 37, 39, 41, 43, 45, 46, 47, 48, 49, 50, 53, 54, 55, 56, 59, 61, 67, 68, 71, 72, 73, 77, 79, 80, 83, 85, 87, 88, 89, 90, 91, 92, 95, 97, 99, 100, 101, 102, 103, 107, 109, 111, 113, 114, 115, 116
OFFSET
1,2
LINKS
EXAMPLE
8 has the prime-factorization of 2^3. The smallest integer > a(7)=8 that is coprime to both 8 and 3 is 11. (9 is not coprime to 3. 10 is not coprime to 8.) So a(8)=11.
MAPLE
A138308 := proc(n) option remember; local pfs, a, p, works ; if n = 1 then 1; else pfs := ifactors(n)[2] ; for a from procname(n-1)+1 do works := true ; if gcd(a, n) > 1 then works := false; else for p in pfs do if gcd(a, op(2, p)) > 1 then works := false; fi; end do ; end if; if works then return a; end if ; end do; end if; end: seq(A138308(n), n=1..120) ; # R. J. Mathar, Oct 24 2009
MATHEMATICA
Fold[Append[#1, SelectFirst[Range[#1[[-1]] + 1, #1[[-1]] + 12], Function[k, AllTrue[Join[{#2}, FactorInteger[#2][[All, -1]] ], CoprimeQ[k, #] &]]]] &, {1}, Range[2, 69]] (* Michael De Vlieger, Oct 18 2017 *)
CROSSREFS
Sequence in context: A120561 A051016 A044951 * A039084 A277641 A378080
KEYWORD
nonn
AUTHOR
Leroy Quet, Mar 13 2008
EXTENSIONS
Extended beyond a(14) by R. J. Mathar, Oct 24 2009
STATUS
approved