Click here to Skip to main content
15,314,824 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
What are the methods of counting prime numbers.
The first idea that came to my mind is matrices, but I don't know if that is the right direction.
Are there any tested libraries for counting prime numbers?

What I have tried:

I was looking for solutions on the internet, but the more I read, the less I know :(
Posted
Updated 14-Dec-21 17:27pm
v2
Comments
PIEBALDconsult 14-Dec-21 17:30pm
   
There are infinite prime numbers.

https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
Terri Miller 2021 14-Dec-21 17:40pm
   
I know what prime numbers are. I mean code implementation. Should you do everything yourself from the beginning or are there any ready-made solutions?

It's good if they were on matrices, but I will also see others.

PIEBALDconsult 14-Dec-21 17:49pm
   
No, it's a popular beginning programming assignment.
And it's fun.

Quote:
Are there any tested libraries for counting prime numbers?

As far as I know, counting prime numbers is not a subject such as one have created a library on this subject.
Quote:
The first idea that came to my mind is matrices, but I don't know if that is the right direction.

I have no idea how counting prime cumbers is related to matrices.

The subject is so basic, that it is just about detecting prime numbers in given range, and counting them. After that, the difference between methods are how clever they are, how they avoid useless work.
   
Prime counting does not involve matrices.

Everything there is to know about the subject is available in this Wikipedia article:
Prime-counting function - Wikipedia[^].

:)
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900