Number should not have a leading zero and it should be a prime number
if ( i - j ) >= 0 and number [ i - j ] != '0' and isPrime ( number [ i - j : i ] ) : NEW_LINE INDENT cnt += rec ( number , i - j , dp ) NEW_LINE cnt %= MOD NEW_LINE DEDENT dp [ i ] = cnt NEW_LINE return dp [ i ] NEW_LINE