OSDir


[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 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 <tomusatov at 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?
> >
> 
> 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