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?

12th Apr 2021, 10:39 PM
Sahaarr
+ 2
[user id=11932555]Coder Kitten[/user] it helped a lot. Thanks🙏🏼🙏🏼
13th Apr 2021, 8:17 AM
Sahaarr
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?
13th Apr 2021, 5:22 AM
Sahaarr
12th Oct 2021, 5:33 AM
Soheyl
0
.. How to write code to print : 1 12 123 1234 12345 Plz i need help i'm beginner ☺️
20th Oct 2021, 9:39 AM
Mohamed Elamin
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/
22nd Oct 2022, 11:29 AM