In the Hidden Number Problem (HNP), the goal is to find a hidden number s, when given p, g and access to an oracle that on query a returns the k most significant bits of s · ga mod p. We present an algorithm solving HNP, when given an advice depending only on p and g; the running time and advice length are polynomial in log p. This algorithm improves over prior HNP algorithms in achieving: (1) optimal number of bits k ≥ 1 (compared with k ≥ Ω(log log p)); (2) robustness to random noise; and (3) handling a wide family of predicates on top of the most significant bit. As a central tool we present an algorithm that, given oracle access to a function f over ZN , outputs all the significant Fourier coefficients of f (i.e., those occupying, say, at least 1% of the energy). This algorithm improves over prior works in being: – Local. Its running time is polynomial in log N and L1(f) (for L1(f) the sum of f’s Fourier coefficients, in absolute value). – Universal. For any N, t, ...