mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Programming (https://www.mersenneforum.org/forumdisplay.php?f=29)
-   -   Power??? (https://www.mersenneforum.org/showthread.php?t=15995)

JohnFullspeed 2011-08-29 17:07

Power???
 
I need to find the first multiple of a prime number > an offset

i/e
Let Offset be 223092870
Let P be 21247
I want N like
Offfset+N = 223 093 500 = 105000 * 12247
223092870 div 21247 = 10499
223093500 -223092870 = 630 = N
I code this but I have a problem when the offset change
I do
N:=P-(offset mod p) Is the problem in the pollynome ?

Thanks

science_man_88 2011-08-29 18:53

[QUOTE=JohnFullspeed;270331]I need to find the first multiple of a prime number > an offset

i/e
Let Offset be 223092870
Let P be 21247
I want N like
Offfset+N = [B]223 093 500 = 105000 * 12247[/B]
[U] 223092870 div 21247 = 10499[/U]
[CODE]223093500 -223092870 = 630 = N[/CODE]
I code this but I have a problem when the offset change
I do
N:=P-(offset mod p) Is the problem in the [I]pollynome[/I] ?

Thanks[/QUOTE]

1)the bold is a massive arithmetic error ( yes I've checked it, and I'm guessing it's a typo?)
2)the underline is a line I personally don't see the use for
3)the italic is a spelling error
4) really because the line I wrapped in code tags says (Offset+N)-Offset = N

5) I come to: X=Offset+(P-(Offset%P)) working no ?

JohnFullspeed 2011-08-30 06:33

Typo
 
( yes I've checked it, and I'm guessing it's a typo?)

Yes I inverse the two first digir of P

21247 is not 12247!!!!
223092870 div 21247 = 10499
P^10499 < Offset
p^10500 > Offset
N= P^10500- Offset
or
N=P-(offset mod p)
N must be >0 and < Offset)
I restart from 0 and I code verifying the error line by line

Have you an idea how to process the Golback conjecture:
all even value is the sum of two primes numbers??

John

science_man_88 2011-08-30 11:29

[QUOTE=JohnFullspeed;270385]( yes I've checked it, and I'm guessing it's a typo?)

Yes I inverse the two first digir of P

21247 is not 12247!!!!
223092870 div 21247 = 10499
P^10499 < Offset
p^10500 > Offset
N= P^10500- Offset
or
N=P-(offset mod p)
N must be >0 and < Offset)
I restart from 0 and I code verifying the error line by line

Have you an idea how to process the Golback conjecture:
all even value is the sum of two primes numbers??

John[/QUOTE]

a code I just made:

[CODE]f=[];for(i=1,100,for(j=1,100,f=concat(f,if((prime(i)+prime(j))%2==0,prime(i)+prime(j)))));vecsort(f,,8)[/CODE]

JohnFullspeed 2011-08-30 15:55

Find!
 
The polynome was goof the error was at the line just after.

I make N= N^2 ((an optimization) but it's good only if you begin at one:

[QUOTE]
[LIST=1][*]Create a list of consecutive integers from 2 to [I]n[/I]: (2, 3, 4, ..., [I]n[/I]).[*]Initially, let [I]p[/I] equal 2, the first prime number.[*]Starting from [I]p[/I], count up in increments of [I]p[/I] and mark each of these numbers greater than [I]p[/I] itself in the list. These numbers will be 2[I]p[/I], 3[I]p[/I], 4[I]p[/I], etc.; note that some of them may have already been marked.[*]Find the first number greater than [I]p[/I] in the list that is not marked; let [I]p[/I] now equal this number (which is the next prime).[*]If [I]p[/I] is less than [I]n[/I], repeat from step 3. Otherwise, stop.[/LIST][/QUOTE]


You can modify

3- Starting from [B][I]p^2[/I][/B], count up in increments of [I]p[/I] and mark each of these numbers greater than [I]p[/I] itself in the list. These numbers will be 2[I]p[/I], 3[I]p[/I], 4[I]p[/I], etc.; note that some of them may have already been marked.

not if you make a continue search not a set of continues integers
John

science_man_88 2011-08-30 16:28

[QUOTE=JohnFullspeed;270408]The polynome was goof the error was at the line just after.

I make N= N^2 ((an optimization) but it's good only if you begin at one:




You can modify

3- Starting from [B][I]p^2[/I][/B], count up in increments of [I]p[/I] and mark each of these numbers greater than [I]p[/I] itself in the list. These numbers will be 2[I]p[/I], 3[I]p[/I], 4[I]p[/I], etc.; note that some of them may have already been marked.

not if you make a continue search not a set of continues integers
John[/QUOTE]

not this again you made another thread!

if you are looking to make a code I'll give you the steps but you likely don't want that.


All times are UTC. The time now is 09:26.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.