OFFSET
1,1
COMMENTS
Conjecture: The only nonprime terms are squares (based on checking the first 2 million terms). - Ivan N. Ianakiev, Mar 28 2021
The conjecture above is false (see A353203 for counterexamples). - Ivan N. Ianakiev, Jul 04 2022
FORMULA
EXAMPLE
The first composite number is 4, and the smallest larger composite to which it is coprime is 9, so a(1) = 9 - 4 = 5.
The second composite number is 6, and the smallest larger composite to which it is coprime is 25, so a(2) = 25 - 6 = 19.
MATHEMATICA
Table[Block[{k = 1}, While[Nand[GCD[#, k] == 1, CompositeQ[# + k]], k++]; k] &@ FixedPoint[n + PrimePi@ # + 1 &, n + PrimePi@ n + 1], {n, 83}] (* Michael De Vlieger, Mar 19 2021 *)
PROG
(PARI) lista(nn) = {forcomposite(c=1, nn, my(x=c+1); while (isprime(x) || (gcd(x, c) != 1), x++); print1(x - c, ", "); ); } \\ Michel Marcus, Mar 04 2021
(Python)
from sympy import isprime, gcd, composite
def A342175(n):
m = composite(n)
k = m+1
while gcd(k, m) != 1 or isprime(k):
k += 1
return k-m # Chai Wah Wu, Mar 28 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
William C. Laursen, Mar 04 2021
STATUS
approved