#OK to post homework #George Spahn, 3-13-2022, Assignment 15 #1 DecDigits := proc(a,K) local left, a1, k, t, L: left := floor(log(a)/log(10))+1: a1:=a: for k from 1 to K do t := 10^(left-k): L[k] := floor(a1/t): a1 := a1 - L[k]*t: od: [seq(L[i],i = 1.. K)]: end: #6 # starting at around N=400, PiAp(N) takes more than 5 seconds. # PiApc(N) can get up to N = 1500 in under 5 seconds. # This makes sense because the recurrence should be much faster than computing the integral. #7 Jesus := proc(n) t1 := 0: f := 1: p := 1: for k from 1 to n do f := -1 * f * (2 * k - 1) / (2 * k): p := p * 2^10: top := 20 * k * (50 + 41 * (k - 1)) + 13: t1 := t1 + (f)^5 * top / p: od: t1 := t1 + 13: (128 / t1)^.5: end: # The error in Jesus(20) is about 10^-9