Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#26 2014-02-05 12:45:40

Primenumbers
Member
Registered: 2013-01-22
Posts: 149

Re: A Way Of Finding Any Prime Number

2m
6m+3
30m+5 or 25
210m+7 or 7x7 or 7x11 or 7x13 or 7x17 or 7x19 or 7x23 or 7x29

For 121 count the No. of numbers it passes and minus it from 121 then -2 for 1 and itself and + 4 for 2, 3, 5, and 7, I got 30 which is the No. of primes below 121


"Time not important. Only life important." - The Fifth Element 1997

Offline

#27 2014-02-05 16:15:49

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: A Way Of Finding Any Prime Number

Hi;

Yes, i think I got it.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#28 2014-02-05 16:40:44

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: A Way Of Finding Any Prime Number

Does it work?


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#29 2014-02-05 16:42:01

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: A Way Of Finding Any Prime Number

So far I have not found a counterexample.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#30 2014-02-05 16:46:37

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,996
Website

Re: A Way Of Finding Any Prime Number

Great!


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#31 2014-02-05 16:50:09

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: A Way Of Finding Any Prime Number

I have not worked very hard on it yet.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#32 2014-02-06 16:48:46

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,877

Re: A Way Of Finding Any Prime Number

Hi,

I don't think I'm understanding it all (sorry).

How does post #26 relate to the rule in post #19?

What does the 'm' in the first four lines of post #26 represent?

I need to have post #26 explained to me.

Also, isn't the p3 missing from this in post #19?:

Let p1=2, p2=3, p4=5 p5=7 p6=11 and so on up to infinity.

And re the first part of the rule in post #19:

Rule= [p2*p3*p4*px]

Shouldn't that read something like [p2*p3*p4*...*px] (or however you properly notate that series). I presume it's intended to be the product of all primes from the second prime (3) to the xth prime.

Here's my code (based on bobbym's) as I understand the post #19 rule:

Last edited by phrontister (2014-02-06 17:21:08)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#33 2014-02-06 19:42:35

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,877

Re: A Way Of Finding Any Prime Number

Here's a slightly amended code that catches two more 'solutions'...that is, if I'm understanding things right (but I'm still very unsure about that).

Last edited by phrontister (2014-02-07 08:02:47)


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#34 2014-02-06 20:18:55

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: A Way Of Finding Any Prime Number

Hi phrontister;

I am not at all sure that the code I have is correct.

My code is for post #11.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#35 2014-02-07 01:17:08

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,877

Re: A Way Of Finding Any Prime Number

Hi Bobby,

Yes, I saw that your code was for that post, but when I checked it out I didn't think it covered all bases and so I came up with my code in post #32.

In your first expression, your formula for the part that is deducted is 2y, whereas Primenumbers has it as this:

[2^y multiplied by any No. that is not divisible by all the primes in the series you used]

I take it that y is any positive integer (see post #19), and that the 11 in the first example in post #11 is the value of z (see post #19), being the next prime after the last in the series (and thus not being divisible by any of the primes in the series).

What's throwing out my thinking about all this is that the examples given by Primenumbers don't appear to agree precisely with the descriptions that precede them and on which they are based.

And I'm still very hazy about post #26.


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#36 2014-02-07 01:37:50

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: A Way Of Finding Any Prime Number

I can not follow it at all and will leave him to you. Good luck and happy hunting.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#37 2014-02-07 22:24:55

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,877

Re: A Way Of Finding Any Prime Number

Re post #26, I don't understand what this means:

Primenumbers wrote:

2m
6m+3
30m+5 or 25
210m+7 or 7x7 or 7x11 or 7x13 or 7x17 or 7x19 or 7x23 or 7x29

One thing that I can see from the 2, 6, 30 and 210 in those four lines is this:
   First line = p1 = 2
   Second line = first line x p2 = 2 x 3 = 6
   Third line = second line x p3 = 6 x 5 = 30
   Fourth line = third line x p4 = 30 x 7 = 210.

And I'm still wondering what the 'm' represents.

Primenumbers wrote:

For 121 count the No. of numbers it passes and minus it from 121 then -2 for 1 and itself and + 4 for 2, 3, 5, and 7, I got 30 which is the No. of primes below 121

What are the 'numbers' in "No. of numbers"? I presume that "it passes" refers to qualifying numbers less than itself.

Anyway, it appears that there are 93 such qualifying numbers, as from the sum above (as I understand it), 121 - 93 - 2 + 4 = 30, which is the answer given.


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

#38 2014-02-19 23:59:40

Primenumbers
Member
Registered: 2013-01-22
Posts: 149

Re: A Way Of Finding Any Prime Number

  because can not have any possible factors other than 1 and itself.


"Time not important. Only life important." - The Fifth Element 1997

Offline

#39 2014-02-20 01:08:54

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: A Way Of Finding Any Prime Number

Hi;

What are the restrictions on a,b,c,d...p and P?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#40 2014-03-20 06:20:36

Primenumbers
Member
Registered: 2013-01-22
Posts: 149

Re: A Way Of Finding Any Prime Number

Prime Number TEST!: (where p is Prime)
             

A=2,6,30,210,2310...(multiply by next prime in series)...(Choose an A which contains all prime numbers found below the square root of p.)

Repeat process until y<p, exchanging y for p. Then when y<p, y will be a recognizable prime (though not found in A), if this is not the case then p is NOT prime.


"Time not important. Only life important." - The Fifth Element 1997

Offline

#41 2014-04-05 13:56:17

atran
Member
Registered: 2013-07-12
Posts: 91

Re: A Way Of Finding Any Prime Number

Primenumbers wrote:

[All the primes in the series up to a point, multiplied together, multiplied by any odd No.], minus, [2^y multiplied by any No. that is not divisible by all the primes in the series you used]. Will equal a prime No. when >1 and <the next No. in the series after the point multiplied by itself by definition. Oh and y must be at least 1.

Assuming that the number, multiplied by 2^y and not divisible by any of those primes, is at least 1 and an integer, then:
1) Given the first two prime numbers, then all the solutions are: 7, 11, 13
2) Given the first three prime numbers, all the solutions are: 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97
3) Given the first four prime numbers, then: 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101
4) Given the first five prime numbers, then: 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103
5) My program can't compute more, the reason may be capacity limitation or inappropriate use of data types...

Anyway, here's the algorithm I wrote to produce the results above:

void print_prime(unsigned short number_of_primes)
{
    unsigned int prime_product = 1, last_prime, largest_prime, prime_out;
    unsigned short number, i, j, k;
    bool flag1 = 1, flag2 = 1;

    for(number=3, i=0; i<number_of_primes; number++)
    {
        if(is_prime(number) == true)
        {
            prime_product *= number;
            i++;
        }
    }

    last_prime = number - 1;

    while(true)
    {
        if(is_prime(number) == true)
        {
            largest_prime = number;
            break;
        }

        number++;
    }

    for(i = 1; true; i += 2)
    {
        for(j = 1; true; j++)
        {
            for(k = 1; true; k++)
            {
                for(number = 3; number<=last_prime; number++)
                {
                    if(is_prime(number) == true)
                        if(k%number == 0) goto next;
                }
                prime_out = prime_product*i - pow(2, j)*k;
                if(prime_out < 2 && i==1 && j==1)
                {
                    flag1 = 0;
                    flag2 = 0;
                    break;
                } else if(prime_out < 2 && j==1)
                {
                    flag2 = 0;
                    break;
                } else if(prime_out < 2) break;
                else if(prime_out < (unsigned int)pow(largest_prime, 2)) {
                        if(is_prime(prime_out) != 1)
                            printf("NOT %d\n", prime_out);
                        else printf("%d\n", prime_out);
                }
                next: ;
            }
            if(flag2 == 0) break;
        }
        if(flag1 == 0) break;
    }
}

The above function basically prints out the solutions for a given number of primes; it also informs if it encounters a composite result. The is_prime() function in the above function is defined as follows:

bool is_prime(unsigned int number)
{
    int i;
    if(number < 2) return false;
    for(i=2; i<=sqrt(number); i++)
    {
        if(number%i == 0) return false;
    } return true;
}

Offline

#42 2014-04-06 00:03:58

atran
Member
Registered: 2013-07-12
Posts: 91

Re: A Way Of Finding Any Prime Number

atran wrote:

Assuming that the number, multiplied by 2^y and not divisible by any of those primes, is at least 1 and an integer, then:
1) Given the first two prime numbers, then all the solutions are: 7, 11, 13
2) Given the first three prime numbers, all the solutions are: 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97
3) Given the first four prime numbers, then: 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101
4) Given the first five prime numbers, then: 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103
5) My program can't compute more, the reason may be capacity limitation or inappropriate use of data types...

Sorry, I didn't list all solutions for each number of primes... Below are the full solutions:
Given the first three prime numbers, all the solutions are: 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103
Given the first four prime numbers, then: 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167
Given the first five prime numbers, then: 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283

Last edited by atran (2014-04-06 00:06:07)

Offline

Board footer

Powered by FluxBB