Honors v22.0101
DUE: MON OCT 1, 11:59pm

This problem was given by Google to advertise for prospective programmers. You will have to expand e^x around x = 1 in a Taylor series,i.e.,

e = 1/0! + 1/1! + 1/2! + 1/3! + 1/4! + ... + 1/n!

Using the BigDecimal class; a scale factor of 1000, and any type of ROUNDing in the "divide" method; and expanding e to 1000 terms find all the 10-digit prime numbers in the expansion to the right of the decimal point. So if your expansion of e gives 2.71828182845904523536028747 and you were looking for 3-digit prime numbers, you would first test 718, then 182, then 828, then 281 etc. An example of BigDecimal division is:

BigDecimal ans1 =one.divide(three, 25, BigDecimal.ROUND_HALF_UP);

where ans1 is the result of dividing the BigDecimal variable one by the BigDecimal variable three. The 25 is the scale factor and indicates how many digits will appear to the right of the decimal point in the answer. BigDecimal.ROUND_HALF_UP is the rounding. In order to calculate e, all of the terms in the expression for e must be declared to be BIgDecimal. Moreover the loop index, let's say j, must be converted to BigDecimal in the loop. Please see the accompanying program on BigDecimal arithmetic:

Note that when you calculate if a 10-digit number, n, is prime, do it in long arithmetic and set the upper limit of the loop to the sqrt(n).

Your output should be the value of e you calculated and a list of the 10-digit primes and their ordinal number.