Number should not have a leading zero and it should be a prime number
if ( i - j >= 0 && number [ i - j ] != ' ' && isPrime ( number . substring ( i - j , i ) ) ) { cnt += rec ( number , i - j , dp ) ; cnt %= MOD ; } } return dp [ i ] = cnt ; }