Skip to main content
edited body
Source Link
lynn
  • 69.2k
  • 11
  • 133
  • 283

Jelly, 17 bytes

Pµạ³,
»⁹ÆRœc7Ç€ṂṪ×⁹Æ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. 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 says that p(x) ≤ 2x, so it suffices to check all primes up to 128x.

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. 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 says that p(x) ≤ 2x, so it suffices to check all primes up to 128x.

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. 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 says that p(x) ≤ 2x, so it suffices to check all primes up to 128x.

Added a link for the postulate.
Source Link
FryAmTheEggman
  • 17.5k
  • 3
  • 40
  • 97

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. 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 postulateBertrand's postulate says that p(x) ≤ 2x, so it suffices to check all primes up to 128x.

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. 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 says that p(x) ≤ 2x, so it suffices to check all primes up to 128x.

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. 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 says that p(x) ≤ 2x, so it suffices to check all primes up to 128x.

added 363 characters in body
Source Link
lynn
  • 69.2k
  • 11
  • 133
  • 283

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. 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 says that p(x) ≤ 2x, so it suffices to check all primes up to 128x.

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. 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.

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. 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 says that p(x) ≤ 2x, so it suffices to check all primes up to 128x.

added 93 characters in body
Source Link
lynn
  • 69.2k
  • 11
  • 133
  • 283
Loading
added 93 characters in body
Source Link
lynn
  • 69.2k
  • 11
  • 133
  • 283
Loading
Source Link
lynn
  • 69.2k
  • 11
  • 133
  • 283
Loading