login
Positions of primes of the form 4*k+1 (A002144) among all primes (A000040).
11

%I #27 Sep 20 2022 09:31:22

%S 3,6,7,10,12,13,16,18,21,24,25,26,29,30,33,35,37,40,42,44,45,50,51,53,

%T 55,57,59,60,62,65,66,68,70,71,74,77,78,79,80,82,84,87,88,89,97,98,

%U 100,102,104,106,108,110,112,113,116,119,121,122,123,126,127,130,134,135

%N Positions of primes of the form 4*k+1 (A002144) among all primes (A000040).

%C The asymptotic density of this sequence is 1/2 (by Dirichlet's theorem). - _Amiram Eldar_, Mar 01 2021

%H Zak Seidov, <a href="/A080147/b080147.txt">Table of n, a(n) for n = 1..10000</a>

%F A002144(n) = A000040(a(n)).

%F Numbers k such that prime(k) AND 2 = 0. - _Gary Detlefs_, Dec 26 2011

%e 7 is in the sequence because the 7th prime, 17, is of the form 4k+1.

%e 4 is not in the sequence because the 4th prime, 7, is not of the form 4k+1.

%p with(numtheory,ithprime); pos_of_primes_k_mod_n(300,1,4);

%p pos_of_primes_k_mod_n := proc(upto_i,k,n) local i,a; a := []; for i from 1 to upto_i do if(k = (ithprime(i) mod n)) then a := [op(a),i]; fi; od; RETURN(a); end;

%p with(Bits): for n from 1 to 135 do if (And(ithprime(n),2)=0) then print(n) fi od; # _Gary Detlefs_, Dec 26 2011

%t Select[Range[135], Mod[Prime[#], 4] == 1 &] (* _Amiram Eldar_, Mar 01 2021 *)

%o (PARI) k=0;forprime(p=2,1e4,k++;if(p%4==1,print1(k", "))) \\ _Charles R Greathouse IV_, Dec 27 2011

%Y Almost complement of A080148 (1 is excluded from both).

%Y Cf. A000040, A002144.

%K nonn,easy

%O 1,1

%A _Antti Karttunen_, Feb 11 2003