OFFSET
1,2
COMMENTS
From Michael De Vlieger, Mar 28 2016 (Start):
a(0) = 0 since 4 is the smallest composite and "unrelated" numbers k with respect to n must be composite and smaller than n. Unrelated numbers k cannot be prime since primes p must either divide or be coprime to n; k cannot equal 1 since 1 is both a divisor of and coprime to n.
The test for unrelated numbers k that belong to n is 1 < gcd(k, n) < k.
(End)
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
FORMULA
See program.
EXAMPLE
composite[1]=4, URS[4]={}, a(1)=0 by convention; n=14, c[14]=24, URS[24]={9,10,14,15,16,18,20,21,22}, a(14)=24-Max[URS[24]]=2.
MATHEMATICA
c[x_] := FixedPoint[x+PrimePi[ # ]+1&, x]; tn[x_] := Table[j, {j, 1, x}]; di[x_] := Divisors[x]; rrs[x_] := Flatten[Position[GCD[tn[x], x], 1]]; rs[x_] := Union[rrs[x], di[x]]; urs[x_] := Complement[tn[x], rs[x]]; Table[c[w]-Max[urs[c[w]]], {w, 1, 128}]
Prepend[Function[k, k - SelectFirst[Range[k - 2, 2, -1], 1 < GCD[#, k] < # &]] /@ Select[Range[6, 138], ! PrimeQ@ # &], 0] (* Michael De Vlieger, Mar 28 2016, Version 10 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Labos Elemer, Aug 15 2002
STATUS
approved