Problem in Finding CB Numbers

What’s the problem in the code

5 out of 9 test cases failed.

Please reply to doubt.

Hi Vivek,
The basic idea is to check whether the substring is prime or not starting from 2.

In the sample test case, the string is 81615 here, 8161 is a prime number and 5 is also a prime number.
And check your if condition because you are skipping one character if the number is prime.

not understood that where i am skipping 1 character.

Hello Vivek,
In your code you are doing start = end, in this case you will skip one character, so you should be doing start= end-1. Also as I told you before, a cb number is a number which is prime. So you need to rewrite the cbnum function so that it checks whether ‘n’ is a prime number or not rather than just checking mod with prime numbers.

Now what’s the problem in the code. 2 out of 9 test cases failed.