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

A383134 Array read by ascending antidiagonals: A(n,k) is the length of the arithmetic progression of only primes having difference n and first term prime(k).

Original entry on oeis.org

2, 1, 1, 2, 3, 1, 1, 1, 2, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 5, 1, 1, 1, 2, 1, 2, 3, 1, 3, 1, 2, 1, 1, 1, 1, 1, 2, 1, 4, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1
Offset: 1

Views

Author

Stefano Spezia, Apr 17 2025

Keywords

Examples

			The array begins as:
  2, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
  1, 3, 2, 1, 2, 1, 2, 1, 1, 2, ...
  2, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
  1, 3, 1, 2, 1, 2, 1, 2, 1, 1, ...
  2, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
  1, 1, 5, 3, 4, 2, 3, 1, 2, 1, ...
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
  1, 3, 2, 1, 2, 1, 1, 1, 2, 2, ...
  2, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
  1, 3, 1, 2, 1, 2, 1, 2, 1, 1, ...
  ...
A(2,2) = 3 since 3 primes are in arithmetic progression with a difference of 2 and the first term equal to the 2nd prime: 3, 5, and 7.
A(6,3) = 5 since 5 primes are in arithmetic progression with a difference of 6 and the first term equal to the 3rd prime: 5, 11, 17, 23, and 29.
		

References

  • Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See p. 139.

Crossrefs

Programs

  • Mathematica
    A[n_,k_]:=Module[{count=1,sum=Prime[k]},While[PrimeQ[sum+=n], count++]; count]; Table[A[n-k+1,k],{n,13},{k,n}]//Flatten

Formula

A(A006512(n),k) = 1 for n > 1.
A(A040976(n),k) = A054977(k+1).
Showing 1-2 of 2 results.