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

a(n) is the difference between the n-th composite number and the smallest larger composite to which it is relatively prime.
2

%I #38 Jul 07 2022 02:12:12

%S 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,

%T 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,

%U 1,1,1,1,1,1,19,1,1,11,13,1,1,5,7,1,1,3,1

%N a(n) is the difference between the n-th composite number and the smallest larger composite to which it is relatively prime.

%C Conjecture: The only nonprime terms are squares (based on checking the first 2 million terms). - _Ivan N. Ianakiev_, Mar 28 2021

%C The conjecture above is false (see A353203 for counterexamples). - _Ivan N. Ianakiev_, Jul 04 2022

%F a(n) = A113496(n) - A002808(n). - _Jon E. Schoenfield_, Mar 04 2021

%e The first composite number is 4, and the smallest larger composite to which it is coprime is 9, so a(1) = 9 - 4 = 5.

%e The second composite number is 6, and the smallest larger composite to which it is coprime is 25, so a(2) = 25 - 6 = 19.

%t 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 *)

%o (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

%o (Python)

%o from sympy import isprime, gcd, composite

%o def A342175(n):

%o m = composite(n)

%o k = m+1

%o while gcd(k,m) != 1 or isprime(k):

%o k += 1

%o return k-m # _Chai Wah Wu_, Mar 28 2021

%Y Cf. A002808, A113496, A353203.

%K nonn

%O 1,1

%A _William C. Laursen_, Mar 04 2021