login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A342175 a(n) is the difference between the n-th composite number and the smallest larger composite to which it is relatively prime. 1
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 (list; graph; refs; listen; history; text; internal format)
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

LINKS

Table of n, a(n) for n=1..83.

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

Cf. A002808, A113496.

Sequence in context: A347670 A139237 A317541 * A258080 A318181 A274995

Adjacent sequences:  A342172 A342173 A342174 * A342176 A342177 A342178

KEYWORD

nonn

AUTHOR

William C. Laursen, Mar 04 2021

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified January 23 15:33 EST 2022. Contains 350514 sequences. (Running on oeis4.)