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.

A167915 Primes which are the sums of two consecutive nonprimes (A141468).

Original entry on oeis.org

5, 17, 19, 29, 31, 41, 43, 53, 67, 71, 79, 89, 97, 101, 103, 109, 113, 127, 131, 137, 139, 149, 151, 163, 173, 181, 191, 197, 199, 211, 223, 229, 233, 239, 241, 251, 257, 269, 271, 281, 283, 293, 307, 311, 317, 331, 337, 349, 353, 367, 373, 379, 389, 401, 409
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Nov 15 2009

Keywords

Comments

Five together with primes that are the sum of two consecutive composite numbers.

Examples

			a(1)=1+4=5, a(2)=8+9=17.
		

Crossrefs

Programs

  • Magma
    [2*n+1: n in [1..300] | (not IsPrime(n) eq not IsPrime(n+1)) and IsPrime(2*n+1)]; // G. C. Greubel, Nov 10 2023
    
  • Mathematica
    2*Select[Range[300], !PrimeQ[#] == !PrimeQ[#+1] && PrimeQ[2*#+1] &] + 1 (* G. C. Greubel, Jul 01 2016; Nov 10 2023 *)
  • SageMath
    [2*n+1 for n in (1..300) if  (not is_prime(n)) - (not is_prime(n+1)) == 0 and is_prime(2*n+1)] # G. C. Greubel, Nov 10 2023

Formula

a(n+1) = A060254(n) = A176902(n+1). - Juri-Stepan Gerasimov, Apr 28 2010

Extensions

Typo corrected and terms checked by D. S. McNeil, Nov 17 2010

A328686 Define a map from the primes to the primes by f(p) = (p-1)/2 if that is prime, or else (p+1)/2 if that is prime, and otherwise is undefined. Start with the n-th prime and iterate f until we cannot go any further; a(n) is the number of steps.

Original entry on oeis.org

0, 1, 1, 2, 2, 3, 0, 0, 3, 0, 0, 1, 0, 0, 4, 0, 1, 1, 0, 0, 2, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1
Offset: 1

Views

Author

Michel Lagneau, Oct 25 2019

Keywords

Comments

For each prime, the end of the trajectory is reached when one cannot generate another prime number from it.
For example, p(3) = 5 -> 2 (1 iteration), so a(3)=1. Also p(5) = 11 -> 5 -> 2 (2 iterations), 23 -> 11 -> 5 -> 2 (3 iterations) and 47 -> 23 -> 11 -> 5 -> 2 (4 iterations). Hence a(3) = 1, a(5) = 2, a(9) = 3 and a(15) = 4.
a(n) = 0 for n = 1, 7, 8, 10, 11, 13, 14, 16, 19, 20, 22, 24, 25, ... The corresponding primes are A176902(n) = 2, 17, 19, 29, 31, 41, 43, ... .
The sequence of the last terms of the trajectories begins with 2, 2, 2, 2, 2, 2, 17, 19, 2, 29, 31, 19, 41, 43, 2, 53, 29, 31, 67, ...
The following table gives the trajectories of the smallest prime requiring 0, 1, 2, 3, 4, 5, 6, iterations:
+------------+----------+------------------------------------------+
| Number of | smallest | trajectory |
| iterations | prime | |
+------------+----------+------------------------------------------+
| 0 | 2 | 2 |
| 1 | 3 | 3 -> 2 |
| 2 | 7 | 7 -> 3 -> 2 |
| 3 | 13 | 13 -> 7 -> 3 -> 2 |
| 4 | 47 | 47 -> 23 -> 11 -> 5 -> 2 |
| 5 | 2879 | 2879 -> 1439 -> 719 -> 359 -> 179 -> 89 |
| 6 | 1065601 | 1065601 -> 532801 -> 266401 -> 133201 -> |
| | | 66601 -> 33301 -> 16651 |
+------------+----------+------------------------------------------+

Examples

			a(15) = 4 because prime(15) = 47 and 47 -> 23 -> 11 -> 5 -> 2 with 4 iterations.
		

Crossrefs

The underlying map is A330310.

Programs

  • Maple
    for n from 1 to 100 do:
       ii:=0:it:=0:p:=ithprime(n):
       for i from 1 to 100 while(ii=0)  :
         p1:=(p-1)/2:p2:=(p+1)/2:
          if type(p1,prime)=false and type(p2,prime)=false
           then
           ii:=1:printf(`%d, `,it):
           else
           it:=it+1:
            if isprime(p1)
             then
              p:=p1:
              else
              p:=p2:
             fi:
             fi:
            od:
           od:
  • Mathematica
    f[p_] := If[PrimeQ[(q = (p-1)/2)], q, If[PrimeQ[(r = (p+1)/2)], r, 0]]; g[n_] := -2 + Length @ NestWhileList[f, n, #>0 &]; g /@ Select[Range[457], PrimeQ] (* Amiram Eldar, Nov 16 2019 *)
Showing 1-2 of 2 results.