Most of us know...
that all primes p>3
are of the form
But, how many are the Plus Primes (6n+1
) and how many are the Minus Primes (6n-1
) in a certain range?
The Challenge
Given an integer k>5
, count how many primes<=k
are PlusPrimes and how many are MinusPrimes.
Examples
for k=100
we have
[5, 11, 17, 23, 29, 41, 47, 53, 59, 71, 83, 89]
12 MinusPrimes
and
[7, 13, 19, 31, 37, 43, 61, 67, 73, 79, 97]
11 PlusPrimes
for k=149
we have
[5, 11, 17, 23, 29, 41, 47, 53, 59, 71, 83, 89, 101, 107, 113, 131, 137, 149]
18 MinusPrimes
and
[7, 13, 19, 31, 37, 43, 61, 67, 73, 79, 97, 103, 109, 127, 139]
15 PlusPrimes
Rules
Your code must output 2 integers: one for the MinusPrimes and one for the PlusPrimes in any order you like (please specify which is which).
This is code-golf: shortest answer in bytes wins!
Test Cases
Input -> Output [MinusPrimes,PlusPrimes]
6->[1,0]
7->[1,1]
86->[11,10]
986->[86,78]
5252->[351,344]
100000->[4806,4784]
4000000->[141696, 141448]
0%6
is a multiple of 6,1%6
cannot be determined,2%6
is a multiple of 2,3%6
is a multiple of 3,4%6
is a multiple of 2, and5%6
cannot be determined. \$\endgroup\$