Heisenberg_480's blog

By Heisenberg_480, history, 2 weeks ago, In English

After reducing the problem to x*(x-1)/n*(n-1)=1/2, we can observe the first few values of n and x for which this equation is satisfied using a simple C++ program.We get first few values of n as 1,64,21,120,697 etc if we observe the difference of these numbers they are 3,17,99,577,...etc which is nothing but 2^2-1,4^2+1,10^2-1,24^2+1,... then we see that 2,4,10,24 follow a pattern and term t(i) of this series is t(i-1)*2+t(i-2).We can simply write a dp and keep adding the differences to a variable to keep track of value of n we have reached.Whenever our sum reaches over 1e12,we break the loop.This is the first value of n over 1e12 to satisfy the equation.We then simple substitute n in original equation and solve the quadratic for x.

  • Vote: I like it
  • +12
  • Vote: I do not like it

»
2 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

wtf

»
2 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Heisenberg_480 (previous revision, new revision, compare).