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.

Showing 1-2 of 2 results.

A336409 Distance from prime(n) to the nearest odd composite that is < prime(n).

Original entry on oeis.org

2, 4, 2, 4, 2, 2, 4, 2, 2, 4, 2, 2, 2, 4, 2, 2, 4, 2, 2, 2, 2, 2, 4, 2, 4, 2, 2, 2, 2, 4, 2, 4, 2, 2, 2, 2, 2, 4, 2, 4, 2, 4, 2, 2, 2, 4, 2, 2, 4, 2, 2, 2, 2, 4, 2, 2, 4, 2, 2, 2, 4, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 4, 2, 2, 2, 2, 2, 4
Offset: 5

Views

Author

Clark Kimberling, Sep 06 2020

Keywords

Examples

			Beginning with prime(5) = 11:  11-9 = 2, 13-9 = 4, 17-15 = 2, 19-15 = 4.
		

Crossrefs

Programs

  • Maple
    A336409 := proc(n)
        local p;
        p := ithprime(n) ;
        for a from p-2 by -2 do
            if not isprime(a) then
                return p-a ;
            end if;
        end do:
    end proc:
    seq(A336409(n),n=5..100) ; # R. J. Mathar, Oct 02 2020
    # second Maple program:
    a:= n-> `if`(isprime(ithprime(n)-2), 4, 2):
    seq(a(n), n=5..100);  # Alois P. Heinz, Oct 02 2020
  • Mathematica
    z = 5000; d = Select[Range[2, z], ! PrimeQ@# && OddQ@# &];  (* A014076 *)
    f[n_] := Select[d, # < Prime[n] &];
    t = Table[Prime[n] - Max[f[n]], {n, 5, 300}]  (* A336409 *)
    Flatten[Position[t, 2]]  (* A336410 *)
    Flatten[Position[t, 4]]  (* A336411 *)

Formula

a(n) = 2 * A175191(n-1). - Alois P. Heinz, Oct 02 2020
a(n) = 2 * (A062301(n) + 1). - Hugo Pfoertner, Oct 02 2020

A336411 a(n) = A029707(n+2) - 3 for n >= 1.

Original entry on oeis.org

2, 4, 7, 10, 14, 17, 23, 25, 30, 32, 38, 40, 42, 46, 49, 54, 57, 61, 66, 78, 80, 86, 95, 101, 106, 110, 113, 117, 137, 139, 141, 145, 149, 168, 170, 173, 175, 179, 187, 198, 203, 206, 209, 212, 222, 227, 231, 233, 250, 253, 259, 262, 265, 274, 283, 285, 291
Offset: 1

Views

Author

Clark Kimberling, Sep 06 2020

Keywords

Comments

Previous name was "Numbers k such that prime(k) - oc(k) = 4, where oc(k) is the greatest odd composite < prime(k)".

Crossrefs

Programs

  • Mathematica
    z = 5000; d = Select[Range[2, z], ! PrimeQ@# && OddQ@# &];  (* A014076 *)
    f[n_] := Select[d, # < Prime[n] &];
    t = Table[Prime[n] - Max[f[n]], {n, 5, 300}]  (* A336409 *)
    Flatten[Position[t, 2]]  (* A336410 *)
    Flatten[Position[t, 4]]  (* this sequence *)

Formula

a(n) = A029707(n+2) - 3 = A155752(n+2) - 2. - Hugo Pfoertner, Oct 02 2020

Extensions

Offset corrected by Mohammed Yaseen, Jul 17 2023
New name from Hugo Pfoertner, Jul 19 2023
Showing 1-2 of 2 results.