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-7 of 7 results.

A373799 Index of n-th prime in A374965.

Original entry on oeis.org

2, 5, 9, 14, 19, 22, 25, 36, 38, 43, 47, 51, 56, 65, 72, 74, 76, 97, 100, 102, 105, 107, 110, 112, 115, 122, 125, 128, 130, 238, 255, 260, 272, 284, 286, 290, 293, 296, 300, 316, 325, 331, 562, 565, 567, 575, 578, 607, 610, 612, 617, 627, 632, 649, 651, 654, 866, 875, 878
Offset: 1

Views

Author

Harvey P. Dale and N. J. A. Sloane, Jul 28 2024

Keywords

Examples

			The fifth prime in order of appearance in A374965 is A375028(5) = 751 = A374965(19), so a(5) = 19.
		

Crossrefs

Cf. A373798 (first differences), A374965, A375028.

Programs

  • Python
    from itertools import count, islice
    from sympy import isprime, nextprime
    def A373799_gen(): # generator of terms
        a, p = 1, 3
        for i in count(1):
            if isprime(a):
                yield i
                a = p-1
            else:
                a = (a<<1)+1
            p = nextprime(p)
    A373799_list = list(islice(A373799_gen(),20)) # Chai Wah Wu, Jul 29 2024

A375028 Primes in A374965 in order of their occurrence.

Original entry on oeis.org

3, 19, 103, 463, 751, 283, 331, 103423, 313, 2671, 1543, 1783, 3823, 68863, 20287, 733, 757, 407896063, 2083, 1093, 2251, 1153, 2371, 1213, 2467, 41023, 2707, 2803, 1453, 119909605576788675546376149602926591, 98238463, 25903, 3405823, 3590143, 3733, 14983, 7603, 7723, 15607, 65306623, 537343, 69151, 3859801644442622798122887215978426484283282692686288680974641672159756287
Offset: 1

Views

Author

Harvey P. Dale and N. J. A. Sloane_, Jul 28 2024

Keywords

Comments

Sequences A050412 and A052333 suggest that it is possible that the present sequence has only finitely many terms. - N. J. A. Sloane, Jul 29 2024

Crossrefs

A373799 gives the indices where the primes appear in A374965.
A373804 gives the primes sorted into increasing or5der.

Programs

  • Mathematica
    nxt[{n_,a_}]:={n+1,If[!PrimeQ[a],2a+1,Prime[n+1]-1]}; Select[NestList[nxt, {1, 1}, 999][[;; , 2]], PrimeQ]
  • Python
    from itertools import islice
    from sympy import isprime, nextprime
    def A375028_gen(): # generator of terms
        a, p = 1, 3
        while True:
            if isprime(a):
                yield a
                a = p-1
            else:
                a = (a<<1)+1
            p = nextprime(p)
    A375028_list = list(islice(A375028_gen(),30)) # Chai Wah Wu, Jul 29 2024

A373798 Divide A374965 into "blocks" by saying that each prime term ends a block; sequence gives lengths of successive blocks.

Original entry on oeis.org

2, 3, 4, 5, 5, 3, 3, 11, 2, 5, 4, 4, 5, 9, 7, 2, 2, 21, 3, 2, 3, 2, 3, 2, 3, 7, 3, 3, 2, 108, 17, 5, 12, 12, 2, 4, 3, 3, 4, 16, 9, 6, 231, 3, 2, 8, 3, 29, 3, 2, 5, 10, 5, 17, 2, 3, 212, 9, 3, 4, 5, 22, 3, 5, 13, 5, 9, 4, 12, 8, 2, 57, 2, 65, 5, 3, 93, 9, 46
Offset: 1

Views

Author

Harvey P. Dale and N. J. A. Sloane, Jul 28 2024

Keywords

Comments

The first 286 terms of the sequence are the result of dividing the first 10000 terms of A374965 into "blocks."
Comment from N. J. A. Sloane, Aug 09 2024 (Start):
Suppose p = A374965(t) is a prime in A374965, and is the s-th prime to appear there (that is, A375028(s) = p and A373799(s) = t). The next term in A374965 is by definition A374965(t+1) = prime(t+1) - 1 = r (say). Then the block starting with r has length a(s+1) = A050412(r) + 1. For example, p = 19 = A374965(5) is the second prime in A374695, so we have s = 2, t = 5, and r = prime(6) - 1 = 13 - 1 = 12. Then A050412(12) = 3, which tells us that a(3) = 3 + 1 = 4. The block is [12, 25, 51, 103].
For a larger example, the s = 285th prime in A374965 is p = 160077823 = A374965(7686), so t = 7686. The next block begins with r = prime(7687) - 1 = 78282. After 39 steps of double-and-add-1 (corresponding to A050412(78282) = 39) we reach the 286th prime in A374965, A374965(7726) = 43036534378594303. (End)

Examples

			A374965 begins
1, 3/ 4, 9, 19/ 12, 25, 51, 103/ 28, 57, 115, 231, 463/ 46, 93, 187, 375, 751/ 70, 141, 283/ 82, 165, ...,
where the primes are followed by slashes, to indicate the blocks. The lengths of the initial blocks are 2, 3, 4, 5, 5, 3, ...
		

Crossrefs

Programs

  • Mathematica
    nxt[{n_, a_}] := {n + 1, If[! PrimeQ[a], 2 a + 1, Prime[n + 1] - 1]}; vvv=NestList[nxt,{1,1},9999][[;;,2]]; Total/@Partition[Length/@SplitBy[vvv,PrimeQ],2] (* Harvey P. Dale, Jul 28 2024 *)

A373804 Primes in A374965 sorted into increasing order.

Original entry on oeis.org

3, 19, 103, 283, 313, 331, 463, 733, 751, 757, 1093, 1153, 1213, 1453, 1543, 1783, 2083, 2251, 2371, 2467, 2671, 2707, 2803, 3733, 3823, 7603, 7723, 8221, 9013, 9661, 14983, 15277, 15607, 16363, 16381, 16843, 17923, 19483, 20287, 21061, 22093, 23173, 24421, 24841, 25903, 27211, 28411
Offset: 1

Views

Author

N. J. A. Sloane, Aug 08 2024

Keywords

Comments

Since we know the first 350199 terms of A374965, and A374965(350199) = 5026186 starts a new doubling chain, we know that any subsequent prime is greater than 5026186. This implies that the terms in the b-file, which are < 5026186, are correct. Of course, if the sequence reaches a Riesel number (cf. A076337) there will be no more primes after that point.
Note that, as can be seen from the b-file in A375028, A374965 contains many primes greater than 5026186 among the first 350199 terms, including one prime with 102410 digits. But these large primes cannot be added to the present b-file until more is discovered about primes following term 350199.

Crossrefs

A373801 a(1) = 2; thereafter, if a(n-1) is prime then a(n) = prime(n) + 1; otherwise a(n) = 2*a(n-1) - 1.

Original entry on oeis.org

2, 4, 7, 8, 15, 29, 18, 35, 69, 137, 32, 63, 125, 249, 497, 993, 1985, 3969, 7937, 72, 143, 285, 569, 90, 179, 102, 203, 405, 809, 114, 227, 132, 263, 140, 279, 557, 158, 315, 629, 1257, 2513, 5025, 10049, 20097, 40193, 200, 399, 797, 228, 455, 909, 1817, 3633, 7265, 14529, 29057, 58113, 116225
Offset: 1

Views

Author

N. J. A. Sloane, Aug 05 2024

Keywords

Comments

Inspired by A374965. Just as the Riesel numbers (A101036 etc.) underlie A374965, so the Sierpinski numbers (A076336 etc.) underlie the present sequence. This means that for both A374965 and the present sequence, it is possible that there are only finitely many prime terms.
What is the next prime after a(1336) = 1486047139543908353?
The next prime in the sequence after a(1336) is the 328-digit prime a(2412) = 11027*2^1075 + 1 =
44637792944394283771459323765390022896709223538983902782431025499369487088325693\
80355294302151494343616855815219642969893790841894306289338825113522293047097809\
14527499539453353195318334412379318970183638103791974206651303944817277532365140\
54865648555402249863235603037071611259242935028448372668756790221309881865220759\
33966337. - Alois P. Heinz, Aug 05 2024
For a(1) any prime, the trajectory converges to this sequence. Just as in A374965, the trajectories appear to converge to a few attractors. In fact it appears that for most values of a(1), the trajectory converges to the present sequence. However, for a(1) = 384 and 767 the trajectories are different. - Chai Wah Wu, Aug 07 2024

Crossrefs

For the primes in this sequence, see A373802 and A373803.

Programs

  • Maple
    A:=Array(1..1200,0);
    t:=2;
    A[1]:= t;
    for n from 2 to 100 do
    if isprime(t) then t:=ithprime(n)+1; else t:=2*t-1; fi;
    A[n]:=t;
    od:
    [seq(A[n],n=1..100)];
  • Mathematica
    Module[{n = 1}, NestList[If[n++; PrimeQ[#], Prime[n] + 1, 2*# - 1] &, 2, 100]] (* Paolo Xausa, Aug 07 2024 *)
  • Python
    from sympy import isprime, nextprime
    def A373801_gen(): # generator of terms
        a, p = 2, 3
        while True:
            yield a
            a, p = p+1 if isprime(a) else (a<<1)-1, nextprime(p)
    A373801_list = list(islice(A373801_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

A375155 a(n) = 2*a(n-1) + 1 for a(n-1) not prime, otherwise a(n) = prime(n) - 1; with a(1) = 147.

Original entry on oeis.org

147, 295, 591, 1183, 2367, 4735, 9471, 18943, 37887, 75775, 151551, 303103, 606207, 1212415, 2424831, 4849663, 9699327, 19398655, 38797311, 77594623, 155189247, 310378495, 620756991, 1241513983, 2483027967, 4966055935, 9932111871, 19864223743, 39728447487, 79456894975
Offset: 1

Views

Author

Chai Wah Wu, Aug 01 2024

Keywords

Comments

Variant of A374965 with initial condition a(1) = 147. If a(1) is prime, the trajectory is: a(1), 2, 4, 9, ... and matches A374965 after the second term. It appears that for most composite a(1), the trajectories also converge towards A374965. This could be due to A050412(n) being small for many composite n.
a(1) = 147 is the first composite number where the trajectory appears not to converge towards A374965.
Other values of a(1) for which the trajectory converges to this sequence are: 295, 591, 1183, 2278, 2367, 3328, 4557, 4602, 4735, 5950, 6072, 6657, 7227, 9115, 9205, 9471, 9612, 9912, 9955, ...

Crossrefs

Programs

  • Mathematica
    Module[{n = 1}, NestList[If[n++; PrimeQ[#], Prime[n] - 1, 2*# + 1] &, 147, 50]] (* Paolo Xausa, Aug 02 2024 *)
  • Python
    from itertools import islice
    from sympy import isprime, nextprime
    def A375155_gen(): # generator of terms
        a, p = 147, 3
        while True:
            yield a
            a, p = p-1 if isprime(a) else (a<<1)|1, nextprime(p)
    A375155_list = list(islice(A375155_gen(),40))
Showing 1-7 of 7 results.