#Mathematica <s>136 80</s> 75 bytes This is a straightforward approach, working outwards from `n`. `n` is a 7-distinct-prime product iff the number of prime factors is 7 (`PrimeNu@#==7`) and none of these factors appears more than once (`SquareFreeQ@#&`). g@n_:=(k=1;While[!(PrimeNu@#==7&&SquareFreeQ@#&)[z=n-⌈k/2](-1)^k⌉,k++];z) My earlier submission (136 bytes) found both the first 7-distinct-prime product above `n` and, if it exists, the first 7-distinct-prime product below `n`. It then simply determined which was closer to `n`. If the products were equidistant, it returned both. The current version checks n-1,n+1,n-2,n+2... until it reaches the first 7-distinct-prime product. This more efficient version adopts the approach Dennis took. The key advance was in using `⌈k/2](-1)^k⌉` to return the series, 1, -1, 2, -2... ---------- g[5] g[860782] g[1425060] 510510 870870 1438710