0

# Right truncatable prime in c++

Truncatable prime is a prime number that when you successively remove digits from one end of the prime, you are left with a new prime number. An example of right truncatable prime is 2399->239->23->2 which remains prime The task is to find all of the 3digit right-truncatable prime numbers. - I used a for loop to first finde all of the prime numbers from 100 to 999 And then added two functions to check the truncatable primes But I couldn't write it correctly so the result is just prime numbers Any hints?

5 Answers

+ 2

[user id=11932555]Coder Kitten[/user] it helped a lot. Thanks🙏🏼🙏🏼

0

[user id=11932555]Coder Kitten[/user] Thank you so much❤️ but I'm not allowed to use arrays. Can you help me do it with functions and loops?

0

.. How to write code to print :
1
12
123
1234
12345
Plz i need help i'm beginner ☺️

0

// C program for // Find the all right truncatable primes in n natural numbers #include // Find all prime numbers which have smaller and equal to given number n void sieve_of_eratosthenes (int prime [], int n) { // Initial two numbers are not prime (0 and 1) prime = 0; prime = 0; // Set the initial (2 to n element is prime) for (int i = 2; i <= n; ++i) { prime [i] = 1; } // Initial 0 and 1 are not prime // We start to 2 for (int i = 2; i * i <= n; ++i) { if (prime [i] == 1) { // When i is prime... https://www.yourtexasbenefits.ltd/

Hot today

Unable to overload +

2 Votes

Hey! [SOLVED]

0 Votes

Pls rectify the errors.

1 Votes

Python list half printed

0 Votes

Find the error please.

0 Votes