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.

A336407 a(n) is the number of composites < n-th odd composite.

Original entry on oeis.org

3, 7, 11, 14, 16, 20, 22, 25, 29, 32, 34, 37, 39, 43, 45, 48, 52, 54, 57, 60, 62, 65, 67, 69, 72, 76, 80, 83, 85, 87, 89, 91, 93, 96, 99, 101, 105, 107, 109, 111, 115, 117, 120, 122, 125, 128, 130, 133, 135, 139, 141, 143, 145, 149, 153, 155, 157, 159, 161
Offset: 1

Views

Author

Clark Kimberling, Jul 20 2020

Keywords

Examples

			a(2) is the number of the numbers 4, 6, 8, 9, 10, 12, 14, these being the composites that are less than 15, which is the 2nd odd composite.
		

Crossrefs

Programs

  • Mathematica
    z = 400; p = Prime[Range[z]];
    c = Select[Range[2, z], ! PrimeQ@# &];  (* A002808 *)
    d = Select[Range[2, z], ! PrimeQ@# && OddQ@# &];  (* A014076 *)
    f[n_] := Select[c, # < d[[n]] &];
    g[n_] := d[[n]] + Select[c, # < d[[n]] &];
    q[n_] := Length[Intersection[p, g[n]]];
    tq = Table[q[n], {n, 1, 120}] (* A336406 *)
    tc = Table[Length[f[n]], {n, 1, 120}] (* A336407 *)
    m = Min[Length[tq], Length[tc]]; Take[tc, m] - Take[tq, m] (* A336408 *)
  • PARI
    n=0;forcomposite(x=4,210,if(x%2,print1(n,", "));n++) \\ Hugo Pfoertner, Jul 26 2020
    
  • Python
    from sympy import primepi
    def A336407(n):
        if n == 1: return 3
        m, k = n, (r:=primepi(n)) + n + (n>>1)
        while m != k:
            m, k = k, (r:=primepi(k)) + n + (k>>1)
        return m-r-2 # Chai Wah Wu, Jul 31 2024

A336408 a(n) = number of composites c+d such that c is a composite and d is the n-th odd composite.

Original entry on oeis.org

1, 4, 7, 8, 10, 13, 15, 17, 20, 22, 24, 24, 26, 31, 33, 35, 38, 40, 43, 44, 46, 47, 49, 52, 53, 58, 63, 63, 64, 66, 66, 68, 71, 73, 75, 77, 79, 80, 82, 84, 89, 91, 91, 94, 98, 99, 102, 103, 105, 109, 110, 111, 114, 117, 120, 122, 123, 125, 128, 129, 131, 131
Offset: 1

Views

Author

Clark Kimberling, Jul 20 2020

Keywords

Comments

The n-th odd composite is A014076(n+1); the n-th composite is A002808(n).

Examples

			a(1) counts this sum: 6+9.
a(2) counts these sums: 6+15, 9+15, 10+15, 12+15.
a(3) counts these: 4+21, 6+21, 9+21, 12+21, 14+21, 15+21, 18+21.
		

Crossrefs

Programs

  • Mathematica
    z = 400; p = Prime[Range[z]];
    c = Select[Range[2, z], ! PrimeQ@# &];  (* A002808 *)
    d = Select[Range[2, z], ! PrimeQ@# && OddQ@# &];  (* A014076 *)
    f[n_] := Select[c, # < d[[n]] &];
    g[n_] := d[[n]] + Select[c, # < d[[n]] &];
    q[n_] := Length[Intersection[p, g[n]]];
    tq = Table[q[n], {n, 1, 120}] (* A336406 *)
    tc = Table[Length[f[n]], {n, 1, 120}] (* A336407 *)
    m = Min[Length[tq], Length[tc]]; Take[tc, m] - Take[tq, m] (* A336408 *)
Showing 1-2 of 2 results.