heading to work, so won't get a chance to interact, but here's my attempt at the sum of logs ratio, I worked on it several hours last night, even tried some lambda stuff. The ratio is getting further away from 1, not sure what's wrong. http://codepad.org/NGUMSICN PS this study group is great, thanks for the help.
in line 68, you are supposed to be dividing by the n-th prime itself, not the number of primes that were generated. I modified your function so that it would return the Nth prime, primes and logList then played with those in Idle (interactively) and it works if you ask for the correct ratio. here's what i got http://codepad.org/LY4PYheE your code modified: http://codepad.org/KyZvGNXj
ahh, wow. I knew it was a reader error! thanks bwCA, kudos.
just modified it using number/primes[-1] and got the same result. Any reason to use pop verses calling the [-1] of the prime list? I would think keeping the list intact for future applications would be more flexible. I guess I wonder why use list.pop() vs list[-1] in general. Don't see the difference.
when i saw that i thought that it was the right thing to do for this solution - pop removes the element from the list and it shouldn't be there when the sum of the logs is calculated.
Join our real-time social learning platform and learn together with your friends!