private static long findNotMagicNumbers(long N)
    {
        int i = findMaxTenth(N);
        long maxPower = (long) Math.pow(10, i);
        long notMagic = 0;
        long value = 0;
        while (value < N && maxPower >= 10) {
            for (int k = 0; value + maxPower <= N; k++) {
                if (notMagic(value) && !isPrime(k)) {
                    notMagic += table[i];
                }
                value += maxPower;
            }
            i--;
            maxPower /= 10;
        }

        if (!notMagic(value))
            notMagic--;

        value++;
        while (value <= N) {
            if (notMagic(value))
                notMagic++;
            value++;
        }
        return notMagic;

    }