| |

VerySource

 Forgot password?
 Register
Search
View: 979|Reply: 6

What are super primes?

[Copy link]

2

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 Invalid IP Address

Post time: 2020-12-15 15:30:01
| Show all posts |Read mode
Two days ago I asked how to write super prime numbers, but now it is getting more and more vague. Can any teacher give me a clear concept of super prime numbers. How exactly is a super prime number?
Reply

Use magic Report

0

Threads

9

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-12-16 00:30:01
| Show all posts
Super prime number: A prime number is a prime number after removing the units digit; removing the units and tens digit is also a prime number; it remains a prime number until the highest digit is retained. This prime number is called a super prime number.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-12-21 19:00:01
| Show all posts
I understand
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 Invalid IP Address

Post time: 2020-12-21 19:15:01
| Show all posts
An n-digit super prime number refers to an n-digit positive integer. The first 1, the first 2 digits,..., And the first n digits are all prime numbers. For example, 7331 is a 4-digit super prime number because 7, 73, 733, 7331 are prime numbers.

#include <stdio.h>
#include <math.h>

#define DEEP 10000 //is the loop depth

int isPrime(int p);
int isSuperPrime(int p);

int isSuperPrime(int p)
{
    if(isPrime(p)&&p>10)
    {
        while(p>10)
        {
            p/=10;
            if(!(isPrime(p)))
                return 0;
        }
        return 1;
    }
    return 0;
}

int isPrime(int p)
{
    int a,i;
    if(p<2)
        return 0;
    else if(p==2)
        return 1;
    a=(int)sqrt(p+1);
    for(i=2;i<=a;i++)
        if(!(p%i))
            return 0;
    return 1;

}
int main()
{
    int i;
    for(i=2;i<DEEP;i++)
        if(isSuperPrime(i))
            printf("%d\t",i);
    getch();
    return 0;
}
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-12-21 19:30:01
| Show all posts
What a sweaty math problem!
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-12-21 19:45:01
| Show all posts
I know what super prime numbers are, but what's the use?
Reply

Use magic Report

0

Threads

1

Posts

1.00

Credits

Newbie

Rank: 1

Credits
1.00

 China

Post time: 2020-12-24 10:22:41
| Show all posts
Is it possible to traverse the first x prime numbers
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list