git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Program to find Primes of the form prime(n+2) * prime(n+1) - prime(n) +- 1.


On Wednesday, October 3, 2018 at 11:12:43 AM UTC-5, Michael Torrie wrote:
> On 10/03/2018 09:26 AM, Musatov wrote:
> > I don't even know where to begin! (I'm reading the Dummies book)
> 
> If you have no experience in computer programming, it's going to be a
> steep learning curve.
> 
> But your first step is to learn Python and how to write programs in it.
> That book and others will help with that.  You'll have to write lots of
> simple programs unrelated to primes along the way that help you
> understand programming concepts.
> 
> If you already have experience in other languages, the task will be easier.
> 
> Computer programming is quite natural to some (small children seem to
> get it much easier than us adults), but I've seen others struggle to
> grasp the abstract concepts for years.
> 
> Once you've grasped basic Python programming, you can return top the
> original problem at hand.  Start by identifying the process or algorithm
> that would find these primes. In other words, how would you do it on pen
> and paper?  Computer programs are not magic.  They are only expressions
> of human thinking. Often some very smart mathematicians have come up
> with powerful algorithms (a step-by-step process) to do these things,
> and your job as a programmer is to turn this mathematical process into a
> computer program using things like loops and Boolean logic. How would
> you find these primes using your pen, paper, and calculator?

Literally, how I found them was taking a list of primes and checking if the calculations with the lesser primes resulted in numbers also further along on the list.

Another way I guess would be to do the calculations then check if the number is prime.