Write down the first n primes.
Erase one of them and the mean of the remaining numbers is 10.
What number did you erase?
10 for N=1 to 100
20 P=nxtprm(P)
30 Tot=Tot+P
40 for I=1 to N
50 T=Tot-prm(I)
55 if N>1 then
60 :Avg=T/(N-1)
70 :if Avg=10 then print I,prm(I),N,P
80 next
90 next
finds
4 7 8 19
meaning,
erase the 4th prime, 7, from the first 8 primes, the last of which is 19.
2 + 3 + 5 + 11 + 13 + 17 + 19 = 70 checks out
|
Posted by Charlie
on 2020-08-03 13:45:23 |