Honors v22.0101
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 BigInteger and BigDecimal classes; 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 by the
BigDecimal variable . 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. Please see the accompanying program
on BigDecimal arithmetic:
http://cs.nyu.edu/courses/spring07/V22.0101-002/Prog1.java