cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

Original entry on oeis.org

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

Views

Author

William C. Laursen, Mar 04 2021

Keywords

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

Examples

			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.
		

Crossrefs

Programs

  • 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 *)
  • 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

Formula

a(n) = A113496(n) - A002808(n). - Jon E. Schoenfield, Mar 04 2021