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.

A373802 Primes in A373801 in order of their appearance.

Original entry on oeis.org

2, 7, 29, 137, 7937, 569, 179, 809, 227, 263, 557, 40193, 797, 464897, 303868936193, 3833, 16097, 4457, 2309, 4793, 4937, 10289, 2693, 11057, 3002369, 52673, 27617, 1823, 7433, 1907, 497153, 4133, 269057, 2438716790407169, 2879, 2903, 93377, 2999
Offset: 1

Views

Author

N. J. A. Sloane, Aug 05 2024

Keywords

Comments

a(239) has 3137 decimal digits and is too long for inclusion in the b-file. - Alois P. Heinz, Aug 05 2024

Crossrefs

Programs

  • Maple
    b:= proc(n) option remember; (m->
         `if`(isprime(m), ithprime(n)+1, 2*m-1))(b(n-1))
        end: b(1):=2:
    g:= proc(n) option remember; local k; for k from 1+g(n-1)
          while not isprime(b(k)) do od; k
        end: g(0):=0:
    a:= n-> b(g(n)):
    seq(a(n), n=1..38);  # Alois P. Heinz, Aug 05 2024
  • Mathematica
    Reap[Module[{n = 1}, Nest[If[n++; PrimeQ[#], Sow[#];Prime[n] + 1, 2*# - 1] &, 2, 500]]][[2, 1]] (* Paolo Xausa, Aug 07 2024 *)
  • Python
    from itertools import count
    from sympy import isprime, nextprime
    def A373802_gen(): # generator of terms
        a, p = 2, 3
        for i in count(1):
            if isprime(a):
                yield a
                a = p+1
            else:
                a = (a<<1)-1
            p = nextprime(p)
    A373802_list = list(islice(A373802_gen(),20)) # Chai Wah Wu, Aug 05 2024

A373803 Indices of primes in A373801.

Original entry on oeis.org

1, 3, 6, 10, 19, 23, 25, 29, 31, 33, 36, 45, 48, 60, 91, 95, 101, 105, 108, 112, 116, 121, 124, 129, 142, 149, 155, 157, 161, 163, 173, 176, 185, 227, 229, 231, 238, 240, 386, 391, 393, 398, 411, 415, 435, 439, 466, 537, 543, 565, 570, 575, 577, 588, 592, 687, 694, 696, 700, 733, 738, 759
Offset: 1

Views

Author

N. J. A. Sloane, Aug 05 2024

Keywords

Crossrefs

Programs

  • Maple
    b:= proc(n) option remember; (m->
         `if`(isprime(m), ithprime(n)+1, 2*m-1))(b(n-1))
        end: b(1):=2:
    a:= proc(n) option remember; local k; for k from 1+a(n-1)
          while not isprime(b(k)) do od; k
        end: a(0):=0:
    seq(a(n), n=1..62);  # Alois P. Heinz, Aug 05 2024
  • Mathematica
    Reap[Module[{n = 1}, Nest[If[n++; PrimeQ[#], Sow[n-1]; Prime[n] + 1, 2*# - 1] &, 2, 1000]]][[2,1]] (* Paolo Xausa, Aug 07 2024 *)
  • Python
    from itertools import count
    from sympy import isprime, nextprime
    def A373803_gen(): # generator of terms
        a, p = 2, 3
        for i in count(1):
            if isprime(a):
                yield i
                a = p+1
            else:
                a = (a<<1)-1
            p = nextprime(p)
    A373803_list = list(islice(A373803_gen(),20)) # Chai Wah Wu, Aug 05 2024

A373805 If a(n-1) is not a prime, then a(n) = 2*a(n-1) + S; otherwise set S = -S and a(n) = prime(n) + S; start with a(1) = S = 1.

Original entry on oeis.org

1, 3, 4, 7, 12, 25, 51, 103, 22, 43, 32, 65, 131, 42, 83, 54, 109, 60, 119, 237, 473, 945, 1889, 90, 181, 100, 199, 108, 217, 435, 871, 1743, 3487, 6975, 13951, 27903, 55807, 162, 323, 645, 1289, 182, 365, 731, 1463, 2927, 210, 419, 228, 457, 232, 463, 242, 485, 971, 262, 523, 272, 545, 1091
Offset: 1

Views

Author

N. J. A. Sloane, Aug 11 2024

Keywords

Comments

The doubling and adding-or-subtracting 1 runs alternate between Riesel type (as in A374965) and Sierpinski type (as in A373801). The interest, as in both of those sequences, is whether the sequence will hit a Riesel or Sierpinski number. If that ever happens, from that point on the sequence will double and add +-1 for ever and no more primes will appear.
After 4000 terms, the doubling run that began at a(2380) = 21168 wass still growing.
This doubling run finally terminated at a(8475) = 21167 * 2^6095 + 1. See link in A373806 for decimal expansion. - Michael De Vlieger, Aug 12 2024

Examples

			We start with a(1) = S = 1. Since 1 is not a prime, a(2) = 2*1 + 1 = 3.
3 is a prime, so now S = -1 and a(3) = prime(3) - 1 = 5-1 = 4.
4 is not a prime, so a(4) = 2*4 - 1 = 7.
And so on.
		

Crossrefs

Programs

  • Maple
    # To get the first 100 terms:
    A:=Array(1..1200, 0);
    t:=1;
    A[1]:= t; S:=1;
    for n from 2 to 100 do
    if not isprime(t) then t:=2*t+S; else S:=-S; t:=ithprime(n)+S; fi;
    A[n]:=t;
    od:
    [seq(A[n], n=1..100)];
  • Mathematica
    nn = 120; s = j = 1; {1}~Join~Reap[Do[If[PrimeQ[j], s = -s; k = Prime[n] + s, k = 2 j + s]; j = k; Sow[k], {n, 2, nn}] ][[-1, 1]] (* Michael De Vlieger, Aug 11 2024 *)
    m = 120; ToExpression /@ Import["https://oeis.org/A373805/a373805.txt", "Data"][[;; m, -1]] (* Generate up to m = 10^5 terms from compactified a-file, Michael De Vlieger, Aug 13 2024 *)
  • Python
    from sympy import sieve, isprime
    from itertools import count, islice
    def A373805_gen(): # generator of terms
        an = S = 1
        for n in count(2):
            yield an
            if not isprime(an): an = 2*an + S
            else: S *= -1; an = sieve[n] + S
    print(list(islice(A373805_gen(), 60))) # Michael S. Branicky, Aug 12 2024
Showing 1-3 of 3 results.