Define the function $[0,+\infty) \rightarrow R$:


$$ f = \cos (t) + \cos (\sqrt{2} t) + \cos (\sqrt{3} t) + \cos (\sqrt{5} t ) . $$


I want a number $t $ bigger than $10^7$ such that 


$$ f(t) > 4 - 10^{-9} . $$


Can anyone give me such a number? Ultimately, I want an algorithm which works for arbitrary precision (say $10^{-900}$).



An algorithm for Poincare recurrence time
You want to find an $s$ such that $s, \sqrt{2} s, \sqrt{3} s, \sqrt{5} s$ are all close to integer. Your $t$ is then given by $2\pi s.$ The first question is a problem in simultaneous Diophantine approximation, an algorithm for which (using lattice reduction) is given by [W.Bosma](http://math.ucsd.edu/~kedlaya/ants10/bosma/paper.pdf) (probably among others).


