private double arbitrary (double n) {

		if ( n <= 10 && n < d ) { return 0; }
		else if ( n <= 10 ) { return 1; }

		// We don't want the actual log, we want the log of the highest power of 10 lower
		// than this number; casting to an int drops the decimal part which accomplishes
		// this.
		int log = (int) Math.log10 (n);
		double lower = powerOfTen (log - 1);
		int first = getDigitAt (n, log);

		// add 1 for the number itself followed by all zeros. This is not counted by just
		// adding the last part.
		if ( first == d ) { return first * lower + getPartAfter (n, log) + 1; }

		double result;
		if ( first < d ) { result = first * lower; }
		else { result = (first-1) * lower + Math.pow (10, log); }

		return result + arbitrary (getPartAfter (n, log));
	}