private double arbitrary (double n) {

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

		double result;
		int first = getFirstDigit (n);
		// 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.
		double log = (int) Math.log10 (n);
		double lower = powerOfTen (log - 1);

		/* System.out.println ("log and lower: " + log + " " + lower); */

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

		/* System.out.println ("result for " + n + " " + result); */

		if ( first != d ) { result += arbitrary (getLast (n)); }

		/* System.out.println ("result for " + n + " " + result); */

		return result;
	}