A109828 Duplicate of A005603.
11, 7, 2, 2131, 1531, 385591, 16651, 15514861, 857095381, 205528443121, 1389122693971, 216857744866621, 758083947856951, 107588900851484911, 69257563144280941, 3203000719597029781
Offset: 1
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.
a005382 n = a005382_list !! (n-1) a005382_list = filter ((== 1) . a010051 . (subtract 1) . (* 2)) a000040_list -- Reinhard Zumkeller, Oct 03 2012
[n: n in [0..1000] | IsPrime(n) and IsPrime(2*n-1)]; // Vincenzo Librandi, Nov 18 2010
f := proc(Q) local t1,i,j; t1 := []; for i from 1 to 500 do j := ithprime(i); if isprime(2*j-Q) then t1 := [op(t1),j]; fi; od: t1; end; f(1); # second Maple program: q:= p-> andmap(isprime, [p, 2*p-1]): select(q, [$2..2500])[]; # Alois P. Heinz, Dec 16 2024
Select[Prime[Range[300]], PrimeQ[2#-1]&]
select(p->isprime(2*p-1),primes(500)) \\ Charles R Greathouse IV, Apr 26 2012
forprime(n=2, 10^3, if(ispseudoprime(2*n-1), print1(n, ", "))) \\ Felix Fröhlich, Jun 15 2014
Both 3 and (3+1)/2 = 2 are primes, both 5 and (5+1)/2 = 3 are primes. - _Zak Seidov_, Nov 19 2012
a005383 n = a005383_list !! (n-1) a005383_list = [p | p <- a065091_list, a010051 ((p + 1) `div` 2) == 1] -- Reinhard Zumkeller, Nov 06 2012
LIMIT = 8000 % Find all members of A005383 less than LIMIT A = primes(LIMIT); n = length(A); %n is number of primes less than LIMIT B = 2*A - 1; C = ones(n, 1)*A; %C is an n X n matrix, with C(i, j) = j-th prime D = B'*ones(1, n); %D is an n X n matrix, with D(i, j) = (i-th prime)*2 - 1 [i, j] = find(C == D); A(j)
[n: n in [1..3300] | IsPrime(n) and IsPrime((n+1) div 2) ]; // Vincenzo Librandi, Sep 25 2012
for n to 300 do X := ithprime(n); Y := ithprime(n+1); Z := 1/2 mod Y; if isprime(Z) then print(Y); end if: end do: # David James Sycamore, Nov 11 2018
Select[Prime[Range[1000]], PrimeQ[(# + 1)/2] &] (* Zak Seidov, Nov 19 2012 *)
A005383_list(n) = select(m->isprime(m\2+1),primes(n)[2..n]) \\ Charles R Greathouse IV, Sep 25 2012
from sympy import isprime [n for n in range(3, 5000) if isprime(n) and isprime((n + 1)//2)] # Indranil Ghosh, Mar 17 2017
[n for n in prime_range(3, 1000) if is_prime((n + 1) // 2)] # F. Chapoton, Dec 17 2019
Triplets are (2,3,5), (19,37,73), (79,157,313), (331,661,1321), ...
[p: p in PrimesUpTo (10000) | IsPrime(2*p-1) and IsPrime(4*p-3)]; // K. D. Bajpai, Jun 26 2017
select(p -> andmap(isprime,[p, 2*p-1, 4*p-3]), [seq(p, p=0..10000)]); # K. D. Bajpai, Jun 26 2017
Select[Prime[Range[1500]],And@@PrimeQ[NestList[2#-1&,#,2]]&] (* Harvey P. Dale, Dec 09 2011 *)
forprime(p= 1, 100000, if(isprime(2*p-1) && isprime(4*p-3), print1(p, ", "))); \\ K. D. Bajpai, Jun 26 2017
Quintuplets are (1531, 3061, 6121, 12241, 24481), (6841, 13681, 27361, 54721, 109441), ...
[ p: p in PrimesUpTo(6*10^5) | forall{q: k in [1..4] | IsPrime(q) where q is 2^k*(p-1)+1} ]; // Bruno Berselli, Nov 23 2011
pQ[n_] := And @@ PrimeQ[NestList[2 # - 1 &, n, 4]]; t = {}; Do[p = Prime[n]; If[pQ[p], AppendTo[t, p]], {n, 42500}]; t (* Jayanta Basu, Jun 17 2013 *) Select[Prime[Range[50000]],AllTrue[Rest[NestList[2#-1&,#,4]],PrimeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Mar 30 2019 *)
Quadruplets are (1531,3061,6121,12241), (2131,4261,8521,17041), ...
Select[Prime[Range[9000]],And@@PrimeQ[NestList[2#-1&,#,3]]&] (* Harvey P. Dale, May 27 2012 *)
First sextuplet is (16651,33301,66601,133201,266401,532801).
[ p: p in PrimesUpTo(6*10^6) | forall{q: k in [1..5] | IsPrime(q) where q is 2^k*(p-1)+1} ]; // Bruno Berselli, Nov 23 2011
a(2)=5 because 2, 5, 11, 23, 47 are prime but 95 is not.
Table[Length[NestWhileList[2#+1&,n,PrimeQ[#]&]],{n,100}]-1 (* Harvey P. Dale, Aug 08 2020 *)
a(n) = {if (! isprime(n), return (0)); d = 1; k = n; while(isprime(p = 2*k+1), k = p; d++;); return (d);} \\ Michel Marcus, Jul 22 2013
Comments