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-3 of 3 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)

A379785 For n >= 2, let b(n) = 1 if A379652(n) is 3 mod 4, 0 if A379652(n) is 1 mod 4; form the RUNS transform of {b(n), n >= 2}.

Original entry on oeis.org

1, 8, 1, 1, 2, 1, 2, 3, 1, 3, 2, 4, 1, 1, 1, 2, 1, 3, 2, 1, 3, 1, 1, 5, 2, 2, 3, 3, 4, 4, 1, 1, 3, 2, 1, 2, 1, 3, 1, 6, 1, 3, 2, 1, 2, 2, 1, 1, 1, 2, 1, 1, 1, 4, 2, 1, 1, 1, 1, 15, 1, 3, 3, 1, 5, 1, 1, 3, 1, 1, 1, 2, 1, 2, 1, 1, 1, 3, 1, 1, 4, 3, 1, 2, 1, 1, 2, 2, 1, 1, 1, 2, 1, 4, 1, 2, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 7, 2, 2
Offset: 1

Views

Author

N. J. A. Sloane, Jan 11 2025

Keywords

Comments

Has the same relationship to A379652 as A379783 does to A379899. See A379783 for further information.

Crossrefs

Programs

  • Mathematica
    nn = 400; c[_] := True; j = 2; q = 0; r = 1;
    Rest@ Reap[Do[m = 2*j + 1;
      While[Set[k, SelectFirst[FactorInteger[m][[All, 1]], c]];
        ! IntegerQ[k], m = 2*m + 1];
      c[k] = False; j = k;
      If[# == r, q++, r = #; Sow[q]; q = 1] &[(Mod[k, 4] - 1)/2],
    {n, nn}] ][[-1, 1]] (* Michael De Vlieger, Jan 11 2025 *)

A380130 For n >= 2, let b(n) = 1 if A379784(n) is 3 mod 4, 0 if A379784(n) is 1 mod 4; form the RUNS transform of {b(n), n >= 2}.

Original entry on oeis.org

1, 6, 13, 34, 87, 229, 581, 1591, 4268, 11637, 31944, 88526, 246105, 688982, 1936129, 5463517, 15470445
Offset: 1

Views

Author

Robert C. Lyons, Jan 12 2025

Keywords

Examples

			A379784 begins 1, 5, 3, 7, 11, 19, 23, 31, 13, 17, 29, 37, ..., and the {b(n), n >= 2} sequence begins 0, 1, 1, 1, 1, 1, 1, 0, ..., whose RUNS transform is 1, 6, ...
		

Crossrefs

Programs

  • Mathematica
    nn = 2^19; c[_] := True; q = 0; j = r = 1; s = 4;
    Monitor[Rest@ Reap[Do[m = j + s;
      While[Set[k, SelectFirst[FactorInteger[m][[All, 1]], c]];
        ! IntegerQ[k], m += s];
      c[k] = False; j = k;
      If[# == r, q++, r = #; Sow[q]; q = 1] &[(Mod[k, 4] - 1)/2],
    {n, nn}] ][[-1, 1]], n] (* Michael De Vlieger, Jan 13 2025 *)
  • Python
    from sympy import primefactors
    prev_a379784 = 1
    prev_b = -1
    b_run = 0
    a379784_set = set([prev_a379784])
    seq = []
    max_seq_len = 17
    while len(seq) < max_seq_len:
        c = prev_a379784
        done = False
        while not done:
            c = c + 4
            factors = primefactors(c)
            for factor in factors:
                if factor not in a379784_set:
                    a379784_set.add(factor)
                    if factor % 4 == 3:
                        b = 1
                    else:
                        b = 0
                    if prev_b >= 0:
                        if b == prev_b:
                            b_run += 1
                        else:
                            seq.append(b_run)
                            b_run = 1
                    else:
                        b_run = 1
                    prev_b = b
                    prev_a379784 = factor
                    done = True
                    break
    print(seq)
Showing 1-3 of 3 results.