MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/learnquant/comments/1y7vvhx/quant_interview_question/19tc3l8m3tym8/
r/learnquant • u/Local_Ad135 • 4d ago
20 comments sorted by
View all comments
1
So 100x99+98x97…
Is there a way to speed that up?
Two copies 100^2 +98^2… is 100+98… too big
99^2+97^2… is 99+97… too smallAdd them together and 2x+50=sum of first 100 squares.
So x= (sum of first 100 squares -50)/2
sum of squares is what n(n+1)(2n+1)/6? (Yes)
So ((100(101)(201)/6)-50)/2) which I would need paper for.
1 u/PsychologicalLie2163 4d ago I've not thought too deeply about it but could you use factorials?If n=100, then 100x99 is the same as n! / (n-2)!. Then I guess you sum over all even integers between 1 and n?
I've not thought too deeply about it but could you use factorials?
If n=100, then 100x99 is the same as n! / (n-2)!. Then I guess you sum over all even integers between 1 and n?
View all comments
1
u/A_BagerWhatsMore 4d ago
So 100x99+98x97…
Is there a way to speed that up?
Two copies 100^2 +98^2… is 100+98… too big
99^2+97^2… is 99+97… too small
Add them together and 2x+50=sum of first 100 squares.
So x= (sum of first 100 squares -50)/2
sum of squares is what n(n+1)(2n+1)/6? (Yes)
So ((100(101)(201)/6)-50)/2) which I would need paper for.