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.

A379899 a(1) = 2. For n > 1, a(n) = smallest prime factor of c=a(n-1)+4 that is not in {a(1), ..., a(n-1)}; if all prime factors of c are in {a(1), ..., a(n-1)}, then we try the next value of c, which is c+4; and so on.

Original entry on oeis.org

2, 3, 7, 11, 5, 13, 17, 29, 37, 41, 53, 19, 23, 31, 43, 47, 59, 67, 71, 79, 83, 103, 107, 127, 131, 139, 151, 163, 167, 179, 61, 73, 89, 97, 101, 109, 113, 137, 149, 157, 173, 181, 193, 197, 229, 233, 241, 257, 269, 277, 281, 293, 313, 317, 337, 349, 353, 373
Offset: 1

Views

Author

Robert C. Lyons, Jan 05 2025

Keywords

Comments

The following are some statistics about how many terms of the sequence are required, so that the first k primes are included:
- The first 10^2 terms include the first 95 primes.
- The first 10^3 terms include the first 697 primes.
- The first 10^4 terms include the first 6783 primes.
- The first 10^5 terms include the first 98563 primes.
Conjecture: this sequence is a permutation of the primes.

Examples

			a(2) is 3 because the prime factors of c=a(1)+4 (i.e., 6) are 2 and 3, and 2 already appears in the sequence as a(1).
a(6) is 13 because the only prime factor of c=a(5)+4 (i.e., 9) is 3 which already appears in the sequence as a(2). The next value of c (i.e., c+4) is 13, which is prime and does not already appear in the sequence.
		

Crossrefs

Programs

  • Maple
    b:= proc(n) option remember; `if`(n<1, {}, b(n-1) union {a(n)}) end:
    a:= proc(n) option remember; local c, p; p:= infinity;
          for c from a(n-1)+4 by 4 while p=infinity do
            p:= min(numtheory[factorset](c) minus b(n-1)) od; p
        end: a(1):=2:
    seq(a(n), n=1..200);  # Alois P. Heinz, Jan 11 2025
  • Mathematica
    nn = 120; c[_] := True; j = 2; s = 4; c[2] = False;
    Reap[Do[m = j + s;
      While[k = SelectFirst[FactorInteger[m][[All, 1]], c];
        ! IntegerQ[k], m += s];
    c[k] = False; j = Sow[k], {nn}] ][[-1, 1]] (* Michael De Vlieger, Jan 11 2025 *)
  • Python
    from sympy import primefactors
    seq = [2]
    seq_set = set(seq)
    max_seq_len=100
    while len(seq) <= max_seq_len:
        c = seq[-1]
        done = False
        while not done:
            c = c + 4
            factors = primefactors(c)
            for factor in factors:
                if factor not in seq_set:
                    seq.append(factor)
                    seq_set.add(factor)
                    done = True
                    break
    print(seq)

A380076 Indices of records in A379899.

Original entry on oeis.org

1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114
Offset: 1

Views

Author

Paolo Xausa, Jan 11 2025

Keywords

Crossrefs

Cf. A379899, A380075 (records).

Programs

  • Mathematica
    nn = 120; c[_] := True; r = j = 2; s = 4; c[2] = False;
    {1}~Join~Reap[Do[m = j + s;
      While[k = SelectFirst[FactorInteger[m][[All, 1]], c];
        ! IntegerQ[k], m += s];
      c[k] = False; j = k;
    If[k > r, r = k; Sow[n]], {n, nn}] ][[-1, 1]] (* Michael De Vlieger, Jan 11 2025 *)
Showing 1-2 of 2 results.