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

2018-10-04 Thread Chris Angelico
On Fri, Oct 5, 2018 at 12:47 AM Alister via Python-list
 wrote:
>
> On Thu, 04 Oct 2018 09:44:01 +0100, Tony van der Hoff wrote:
>
> > On 04/10/18 09:31, Alister via Python-list wrote:
> >> On Wed, 03 Oct 2018 09:43:07 -0700, Musatov wrote:
> >>
> >>> 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.
> >>
> >> That is exactly how you do it with in a program.
> >>
> >> create a loop & check to see if the target number can be divided by
> >> each possible divisor in turn .
> >> for large numbers this will take a large number of tests (hey that is
> >> why you have the computer do them, it is faster than you & does not get
> >> bored ;-) ) there are numerous tricks for speeding up this process once
> >> you have the basic working.
> >>
> >> start by testing small numbers & then use your real data once you have
> >> something that works
> >>
> >> as a starter a simple loop in python could be as follows
> >>
> >> for x in xrange(10):
> >>  print x
> >>
> >> once you have an outline of a program post it back here if things dont
> >> work as expected
> >>
> >>
> > Two lines, two errors! To save the noob a lot of head-scratching, that
> > should be:
> > for x in range(10):
> >
> > If you're running python 3, as you should do for any new project:
> >   print( x )
>
> perfectly legit python 2.7
> I probably should have considered writing python 3 compatible code but
> range operates differently on the 2 versions & would be a poor choice for
> python 2 when numbers get larger

For a loop with a print in it, I'd definitely just use range(). It'll
work on all versions, and long before you run into problems with the
RAM usage on Py2, you've spammed your terminal so much that you're
waiting for it :)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2018-10-04 Thread Alister via Python-list
On Thu, 04 Oct 2018 09:44:01 +0100, Tony van der Hoff wrote:

> On 04/10/18 09:31, Alister via Python-list wrote:
>> On Wed, 03 Oct 2018 09:43:07 -0700, Musatov wrote:
>> 
>>> 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.
>> 
>> That is exactly how you do it with in a program.
>> 
>> create a loop & check to see if the target number can be divided by
>> each possible divisor in turn .
>> for large numbers this will take a large number of tests (hey that is
>> why you have the computer do them, it is faster than you & does not get
>> bored ;-) ) there are numerous tricks for speeding up this process once
>> you have the basic working.
>> 
>> start by testing small numbers & then use your real data once you have
>> something that works
>> 
>> as a starter a simple loop in python could be as follows
>> 
>> for x in xrange(10):
>>  print x
>> 
>> once you have an outline of a program post it back here if things dont
>> work as expected
>> 
>> 
> Two lines, two errors! To save the noob a lot of head-scratching, that
> should be:
> for x in range(10):
> 
> If you're running python 3, as you should do for any new project:
>   print( x )

perfectly legit python 2.7
I probably should have considered writing python 3 compatible code but 
range operates differently on the 2 versions & would be a poor choice for 
python 2 when numbers get larger

ass for the head scratching a noob (& anyone else for that mater) far 
more from correcting code than they do from simply copy & pasting working 
code.




-- 
TAILFINS!! ... click ...
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2018-10-04 Thread Tony van der Hoff
On 04/10/18 09:31, Alister via Python-list wrote:
> On Wed, 03 Oct 2018 09:43:07 -0700, Musatov wrote:
> 
>> 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.
> 
> That is exactly how you do it with in a program.
> 
> create a loop & check to see if the target number can be divided by each 
> possible divisor in turn
> .
> for large numbers this will take a large number of tests (hey that is why 
> you have the computer do them, it is faster than you & does not get 
> bored ;-) ) there are numerous tricks for speeding up this process once 
> you have the basic working.
> 
> start by testing small numbers & then use your real data once you have 
> something that works
> 
> as a starter a simple loop in python could be as follows
> 
> for x in xrange(10):
>   print x
> 
> once you have an outline of a program post it back here if things dont 
> work as expected
> 

Two lines, two errors! To save the noob a lot of head-scratching, that
should be:
for x in range(10):

If you're running python 3, as you should do for any new project:
print( x )



-- 
Tony van der Hoff| mailto:t...@vanderhoff.org
Buckinghamshire, England |
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2018-10-04 Thread Alister via Python-list
On Wed, 03 Oct 2018 09:43:07 -0700, Musatov wrote:

> 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.

That is exactly how you do it with in a program.

create a loop & check to see if the target number can be divided by each 
possible divisor in turn
.
for large numbers this will take a large number of tests (hey that is why 
you have the computer do them, it is faster than you & does not get 
bored ;-) ) there are numerous tricks for speeding up this process once 
you have the basic working.

start by testing small numbers & then use your real data once you have 
something that works

as a starter a simple loop in python could be as follows

for x in xrange(10):
print x

once you have an outline of a program post it back here if things dont 
work as expected



-- 
A narcissist is someone better looking than you are.
-- Gore Vidal
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2018-10-03 Thread Musatov
On Tuesday, October 2, 2018 at 5:54:30 PM UTC-5, Gary Herron wrote:
> On 10/02/2018 01:23 PM, tomusa...@gmail.com wrote:
> >   Primes of the form prime(n+2) * prime(n+1) - prime(n) +- 1.
> > DATA
> >
> > 31, 71, 73, 137, 211, 311, 419, 421, 647, 877, 1117, 1487, 1979, 2447, 
> > 3079, 3547, 4027, 7307, 7309, 12211, 14243, 18911, 18913, 23557, 25439, 
> > 28729, 36683, 37831, 46853, 50411, 53129, 55457, 57367, 60251, 67339, 
> > 70489, 74797, 89669, 98909, 98911
> > 
> > EXAMPLE 
> >
> > 7*5 - 3 - 1 = 31
> >
> > 11*7 - 5 - 1 = 71
> >
> > 11*7 - 5 + 1 = 73
> >
> > 13*11 - 7 + 1 = 137
> >
> > Can someone put this in a Python program and post?
> 
> 
> No, sorry, but that's not how this works.  We're not here to do your 
> homework for you, and you won't learn anything if we do.  You make an 
> attempt at solving this, asking any specific Python related questions 
> you need help with, and you'll find this to be prompt, friendly, and 
> helpful group.
> 
> 
> Gary Herron
> 
> 
> -- 
> Dr. Gary Herron
> Professor of Computer Science
> DigiPen Institute of Technology
> (425) 895-4418

Thank you, Gary. I checked out your program at DigiPen, looks neat.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2018-10-03 Thread Musatov
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.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2018-10-03 Thread Michael Torrie
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?
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2018-10-03 Thread Chris Angelico
On Thu, Oct 4, 2018 at 1:31 AM Musatov  wrote:
>
> On Tuesday, October 2, 2018 at 6:13:01 PM UTC-5, Rick Johnson wrote:
> > Musatov wrote:
> >
> > > I am drafting a sequence for OEIS.
> >
> > And, have you tried your hand at any Python code yet? Or any
> > tutorials?
> I am reading this: 
> https://doc.lagout.org/programmation/python/Beginning%20Programming%20with%20Python%20for%20Dummies%20%5BMueller%202014-09-22%5D.pdf
> >
> > > I was told Python was most accessible for beginners.
> >
> > And you were told correctly!
> >
> > However, be warned that if you happen to become the next
> > victim of one of our overzealous hall monitors[1], there is
> > probably very little i can do to help you -- except, perhaps
> > -- to inform you that switching to the "comp.lang.python"
> > newsgroup (accessible from GoogleGroups or any Usenet
> > newsreader) will ensure that at least ~some~ of us will see
> > your messages.
> >
> > Since GvR has resigned, the community has been in something
> > of a turmoil. And for some reason -- thus far unbeknownst to
> > me, but soon to be unearth by brute force if necessary! --
> > the moderators have gone bad-guano crazy and are purging
> > members who have been sacrificing blood, sweat and tears
> > for, oh... i dunno... *DECADES*!!! Thus, to say that i'm
> > both saddened and angered by the current state of affairs,
> > would be an understatement.
> >

In case you haven't noticed, you're responding to one of the
newsgroup's resident trolls. His posts have been completely blocked
from the python-list mailing list for very good reason. I recommend
ignoring him. Don't engage the trolls and eventually they might get
bored of the sound of their own voices.

(Not that I have very high hopes in his case. He could almost join Jim
Hacker in parliament.)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2018-10-03 Thread Musatov
On Tuesday, October 2, 2018 at 3:49:14 PM UTC-5, Rick Johnson wrote:
> Musatov wrote:
> 
> > Well you don't know until you ask.
> 
> Fair enough.
> 
> So, uh, have you made any attempt to compose a Python program from this 
> assignment?
> 
> If so, don't be shy... let's see it!

I don't even know where to begin! (I'm reading the Dummies book)
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2018-10-03 Thread Musatov
On Tuesday, October 2, 2018 at 6:13:01 PM UTC-5, Rick Johnson wrote:
> Musatov wrote:
> 
> > I am drafting a sequence for OEIS.
> 
> And, have you tried your hand at any Python code yet? Or any
> tutorials?
I am reading this: 
https://doc.lagout.org/programmation/python/Beginning%20Programming%20with%20Python%20for%20Dummies%20%5BMueller%202014-09-22%5D.pdf
> 
> > I was told Python was most accessible for beginners.
> 
> And you were told correctly! 
> 
> However, be warned that if you happen to become the next
> victim of one of our overzealous hall monitors[1], there is
> probably very little i can do to help you -- except, perhaps
> -- to inform you that switching to the "comp.lang.python"
> newsgroup (accessible from GoogleGroups or any Usenet
> newsreader) will ensure that at least ~some~ of us will see
> your messages.
> 
> Since GvR has resigned, the community has been in something
> of a turmoil. And for some reason -- thus far unbeknownst to
> me, but soon to be unearth by brute force if necessary! --
> the moderators have gone bad-guano crazy and are purging
> members who have been sacrificing blood, sweat and tears
> for, oh... i dunno... *DECADES*!!! Thus, to say that i'm
> both saddened and angered by the current state of affairs,
> would be an understatement.
> 
> At this point I'm not sure how ugly this battle may
> become...
> 
> But, i can tell you one thing with absolute certainty...
> 
> The people who have invested their lives into this language
> and this community, and for all of these many years, are not
> about to stand idle as a few hijackers move-in and destroy
> everything we've known, experienced and loved about this
> community and this language.
I saw it finally made #3! Congrats to the community.
https://www.tiobe.com/tiobe-index//

> 
> Yes, Guido is gone. And no, i cannot be sure if he will ever
> return. But for those of us who _remain_, the fire of
> passion still burns in each of our hearts for the little
> language that we love so dearly -- AND I'LL BE *DAMNED*! --
> if some puny, little hall-monitor *PUNK*, is going to come
> in here and destroy -- with snobbish flicks of his harry
> potter wand! -- *ALL* of the blood, sweat and tears that
> have been *SACRIFICED* on the alters of progress for a
> idealist dream that this little peon wretch couldn't even
> fathom!
> 
> 
> @Ethan Furman: The window for civility is quickly closing.
> You, and you _ALONE_, have the power to reverse this toxic
> course and sail our ship back into calmer waters before we
> have ourselves an outright *MUTINY*. I have called upon the
> members of this community to voice their frustrations with
> your Captain-Bligh-inspired leadership, and, as a result,
> your name and reputation have suffered greatly. However,
> there is still time, should you choose to harness it, to ask
> for forgiveness and right these wrongs. But i must remind
> you, that haste is of the essence. For the hour is late.
> THE. HOUR. IS... *LATE*!
> 
> 
> [1] And be particularly cautious around one who's name
> sort-of-rhymes with: "Eatin' Turdcan".

-- 
https://mail.python.org/mailman/listinfo/python-list


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

2018-10-03 Thread Musatov
On Tuesday, October 2, 2018 at 5:01:43 PM UTC-5, Max Zettlmeißl wrote:
> On Tue, Oct 2, 2018 at 10:23 PM, Musatov  wrote:
> >  Primes of the form prime(n+2) * prime(n+1) - prime(n) +- 1.
> > DATA
> >
> > 31, 71, 73, 137, 211, 311, 419, 421, 647, 877, 1117, 1487, 1979, 2447, 
> > 3079, 3547, 4027, 7307, 7309, 12211, 14243, 18911, 18913, 23557, 25439, 
> > 28729, 36683, 37831, 46853, 50411, 53129, 55457, 57367, 60251, 67339, 
> > 70489, 74797, 89669, 98909, 98911
> >
> > EXAMPLE
> >
> > 7*5 - 3 - 1 = 31
> >
> > 11*7 - 5 - 1 = 71
> >
> > 11*7 - 5 + 1 = 73
> >
> > 13*11 - 7 + 1 = 137
> >
> > Can someone put this in a Python program and post?
> >
> 
> Here you go, my friend:
> 
> #!/usr/bin/env python3
> 
> primes = """Primes of the form prime(n+2) * prime(n+1) - prime(n) +- 1.
> DATA
> 
> 31, 71, 73, 137, 211, 311, 419, 421, 647, 877, 1117, 1487, 1979, 2447, 3079, 
> 35\
> 47, 4027, 7307, 7309, 12211, 14243, 18911, 18913, 23557, 25439, 28729, 36683, 
> 3\
> 7831, 46853, 50411, 53129, 55457, 57367, 60251, 67339, 70489, 74797, 89669, 
> 989\
> 09, 98911
> 
> EXAMPLE
> 
> 7*5 - 3 - 1 = 31
> 
> 11*7 - 5 - 1 = 71
> 
> 11*7 - 5 + 1 = 73
> 
> 13*11 - 7 + 1 = 137 """
> 
> if __name__ == "__main__":
> print(primes)
> 
> 
> As soon as you start showing more effort yourself in the form of your
> honest attempts to create a program or at least in the form of some
> serious ideas, you might get replies which better fit what you
> attempted to receive.

Hi Max,

I think I see the code you made pretty much just outputs the data I already 
have. At least I learned something.

Thanks,

Martin
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2018-10-02 Thread Gary Herron

On 10/02/2018 01:23 PM, tomusa...@gmail.com wrote:

  Primes of the form prime(n+2) * prime(n+1) - prime(n) +- 1.
DATA

31, 71, 73, 137, 211, 311, 419, 421, 647, 877, 1117, 1487, 1979, 2447, 3079, 
3547, 4027, 7307, 7309, 12211, 14243, 18911, 18913, 23557, 25439, 28729, 36683, 
37831, 46853, 50411, 53129, 55457, 57367, 60251, 67339, 70489, 74797, 89669, 
98909, 98911

EXAMPLE 

7*5 - 3 - 1 = 31

11*7 - 5 - 1 = 71

11*7 - 5 + 1 = 73

13*11 - 7 + 1 = 137

Can someone put this in a Python program and post?



No, sorry, but that's not how this works.  We're not here to do your 
homework for you, and you won't learn anything if we do.  You make an 
attempt at solving this, asking any specific Python related questions 
you need help with, and you'll find this to be prompt, friendly, and 
helpful group.



Gary Herron


--
Dr. Gary Herron
Professor of Computer Science
DigiPen Institute of Technology
(425) 895-4418


--
https://mail.python.org/mailman/listinfo/python-list


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

2018-10-02 Thread Martin Musatov
I am drafting a sequence for OEIS.

I was told Python was most accesible for beginners.

On Tue, Oct 2, 2018, 4:48 PM Bob Gailer  wrote:

> On Oct 2, 2018 4:59 PM, "Musatov"  wrote:
> >
> >  Primes of the form prime(n+2) * prime(n+1) - prime(n) +- 1.
> > DATA
> >
> > 31, 71, 73, 137, 211, 311, 419, 421, 647, 877, 1117, 1487, 1979, 2447,
> 3079, 3547, 4027, 7307, 7309, 12211, 14243, 18911, 18913, 23557, 25439,
> 28729, 36683, 37831, 46853, 50411, 53129, 55457, 57367, 60251, 67339,
> 70489, 74797, 89669, 98909, 98911
> >
> > EXAMPLE
> >
> > 7*5 - 3 - 1 = 31
> >
> > 11*7 - 5 - 1 = 71
> >
> > 11*7 - 5 + 1 = 73
> >
> > 13*11 - 7 + 1 = 137
> >
> > Can someone put this in a Python program and post?
>
> It is our policy to not write code at others requests. We are glad to help
> if you've started writing a program and are stuck.
>
> Out of curiosity where does this request come from?
>
> If you want to hire one of us to write the program, in other words pay us
> for our time and expertise, that's a different matter. We would be happy to
> comply.
> > --
> > https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2018-10-02 Thread Max Zettlmeißl via Python-list
On Tue, Oct 2, 2018 at 10:23 PM, Musatov  wrote:
>  Primes of the form prime(n+2) * prime(n+1) - prime(n) +- 1.
> DATA
>
> 31, 71, 73, 137, 211, 311, 419, 421, 647, 877, 1117, 1487, 1979, 2447, 3079, 
> 3547, 4027, 7307, 7309, 12211, 14243, 18911, 18913, 23557, 25439, 28729, 
> 36683, 37831, 46853, 50411, 53129, 55457, 57367, 60251, 67339, 70489, 74797, 
> 89669, 98909, 98911
>
> EXAMPLE
>
> 7*5 - 3 - 1 = 31
>
> 11*7 - 5 - 1 = 71
>
> 11*7 - 5 + 1 = 73
>
> 13*11 - 7 + 1 = 137
>
> Can someone put this in a Python program and post?
>

Here you go, my friend:

#!/usr/bin/env python3

primes = """Primes of the form prime(n+2) * prime(n+1) - prime(n) +- 1.
DATA

31, 71, 73, 137, 211, 311, 419, 421, 647, 877, 1117, 1487, 1979, 2447, 3079, 35\
47, 4027, 7307, 7309, 12211, 14243, 18911, 18913, 23557, 25439, 28729, 36683, 3\
7831, 46853, 50411, 53129, 55457, 57367, 60251, 67339, 70489, 74797, 89669, 989\
09, 98911

EXAMPLE

7*5 - 3 - 1 = 31

11*7 - 5 - 1 = 71

11*7 - 5 + 1 = 73

13*11 - 7 + 1 = 137 """

if __name__ == "__main__":
print(primes)


As soon as you start showing more effort yourself in the form of your
honest attempts to create a program or at least in the form of some
serious ideas, you might get replies which better fit what you
attempted to receive.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2018-10-02 Thread Bob Gailer
On Oct 2, 2018 4:59 PM, "Musatov"  wrote:
>
>  Primes of the form prime(n+2) * prime(n+1) - prime(n) +- 1.
> DATA
>
> 31, 71, 73, 137, 211, 311, 419, 421, 647, 877, 1117, 1487, 1979, 2447,
3079, 3547, 4027, 7307, 7309, 12211, 14243, 18911, 18913, 23557, 25439,
28729, 36683, 37831, 46853, 50411, 53129, 55457, 57367, 60251, 67339,
70489, 74797, 89669, 98909, 98911
>
> EXAMPLE
>
> 7*5 - 3 - 1 = 31
>
> 11*7 - 5 - 1 = 71
>
> 11*7 - 5 + 1 = 73
>
> 13*11 - 7 + 1 = 137
>
> Can someone put this in a Python program and post?

It is our policy to not write code at others requests. We are glad to help
if you've started writing a program and are stuck.

Out of curiosity where does this request come from?

If you want to hire one of us to write the program, in other words pay us
for our time and expertise, that's a different matter. We would be happy to
comply.
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list