# Jelly, 17 bytes Pµạ³, »⁹ÆRœc7Ç€ṂṪ Works in theory, but takes many years to complete. --- Here is a version that actually works for the given inputs, but theoretically fails for large inputs: Pµạ³, 50ÆRœc7Ç€ṂṪ [Try it here.](http://jelly.tryitonline.net/#code=UMK14bqhwrMsCjYww4ZSxZNjN8OH4oKs4bmC4bmq&input=&args=ODYwNzgy) This generates all primes up to 50, then finds all 7-combinations of primes in that list, and then all their products. Finally, it simply finds the closest element from that list to the given argument. Of course, once our 7DPs contain primes higher than 50, this will fail. The theoretical version generates all primes up to **256n** for an input **n**, but otherwise works the same way. ## Proof Let `p(x)` denote the next prime after `x`. An (extremely loose) upper bound for the closest 7DP product to x is: p(x) * p(p(x)) * p(p(p(x))) * ... * p(p(p(p(p(p(p(x))))))) So we only need to check primes in **[2…p(p(p(p(p(p(p(x)))))))]**. [Bertrand's postulate](https://en.wikipedia.org/wiki/Bertrand%27s_postulate) says that **p(x) ≤ 2x**, so it suffices to check all primes up to **128x**.