[go: up one dir, main page]

login
A342175
a(n) is the difference between the n-th composite number and the smallest larger composite to which it is relatively prime.
2
5, 19, 1, 1, 11, 13, 1, 1, 5, 7, 1, 1, 3, 1, 1, 1, 1, 5, 19, 1, 1, 1, 1, 13, 1, 1, 9, 13, 1, 1, 3, 1, 1, 1, 1, 3, 1, 1, 1, 1, 5, 17, 1, 1, 1, 1, 19, 1, 1, 11, 5, 1, 1, 1, 1, 7, 1, 1, 3, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 19, 1, 1, 11, 13, 1, 1, 5, 7, 1, 1, 3, 1
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
a(n) = A113496(n) - A002808(n). - Jon E. Schoenfield, Mar 04 2021
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