1
$\begingroup$

I have tried to solve the following equation as shown in the code using Reduce command, but I can't solve for the values of a, b, p. with 'p' is a prime number,I used also FindInstance command, but I didn't get any result.

Code:

Reduce[a^n == b! + p && 50 >= n > 0 && 40 >= a > 0 && 30 > p > 0 && 30 > p > 0, {a, b, p}, Integers] 
$\endgroup$
6
  • 2
    $\begingroup$ Your code gave me 172 solutions (Version 13.1, Mac M1): i.sstatic.net/nmikC.jpg $\endgroup$ Commented Jul 13, 2022 at 22:40
  • $\begingroup$ @MichaelE2 The unique solutions are (2, 2, 2) and (3, 4, 3). $\endgroup$ Commented Jul 13, 2022 at 22:48
  • 1
    $\begingroup$ What about a == 12 && b == 3 && p == 6? It seems to work (for n == 1). $\endgroup$ Commented Jul 13, 2022 at 23:24
  • $\begingroup$ This shows that all 172 solutions satisfy the equation and conditions: i.sstatic.net/OQLTk.png — Note that it takes almost a minute to run, so maybe you did not wait long enough? (I guess it's clear that @Bill gets only 136 because the exhaustive search excludes n <= 0, and the Reduce code does not. Reduce may be doing an exhaustive search itself, after determining the search space.) $\endgroup$ Commented Jul 14, 2022 at 15:44
  • 5
    $\begingroup$ @zeraouliarafik , you have tow times 30 > p > 0 && 30 > p > 0 Think one should be a b . Please only present us a code you have proofed to be right ! Otherwise you waste our time. $\endgroup$ Commented Jul 15, 2022 at 9:56

1 Answer 1

1
$\begingroup$
Reduce[a^n == b! + p && 50 >= n > 0 && 40 >= a > 0 && 30 > p > 0 && 30 > b > 0 && p \[Element] Primes, {a, b, p}, Integers] 

(n == 1 && a == 3 && b == 1 && p == 2) || (n == 1 && a == 4 && b == 1 && p == 3) || (n == 1 && a == 4 && b == 2 && p == 2) || (n == 1 && a == 5 && b == 2 && p == 3) || (n == 1 && a == 6 && b == 1 && p == 5) || (n == 1 && a == 7 && b == 2 && p == 5) || (n == 1 && a == 8 && b == 1 && p == 7) || (n == 1 && a == 8 && b == 3 && p == 2) || (n == 1 && a == 9 && b == 2 && p == 7) || (n == 1 && a == 9 && b == 3 && p == 3) || (n == 1 && a == 11 && b == 3 && p == 5) || (n == 1 && a == 12 && b == 1 && p == 11) || (n == 1 && a == 13 && b == 2 && p == 11) || (n == 1 && a == 13 && b == 3 && p == 7) || (n == 1 && a == 14 && b == 1 && p == 13) || (n == 1 && a == 15 && b == 2 && p == 13) || (n == 1 && a == 17 && b == 3 && p == 11) || (n == 1 && a == 18 && b == 1 && p == 17) || (n == 1 && a == 19 && b == 2 && p == 17) || (n == 1 && a == 19 && b == 3 && p == 13) || (n == 1 && a == 20 && b == 1 && p == 19) || (n == 1 && a == 21 && b == 2 && p == 19) || (n == 1 && a == 23 && b == 3 && p == 17) || (n == 1 && a == 24 && b == 1 && p == 23) || (n == 1 && a == 25 && b == 2 && p == 23) || (n == 1 && a == 25 && b == 3 && p == 19) || (n == 1 && a == 26 && b == 4 && p == 2) || (n == 1 && a == 27 && b == 4 && p == 3) || (n == 1 && a == 29 && b == 3 && p == 23) || (n == 1 && a == 29 && b == 4 && p == 5) || (n == 1 && a == 30 && b == 1 && p == 29) || (n == 1 && a == 31 && b == 2 && p == 29) || (n == 1 && a == 31 && b == 4 && p == 7) || (n == 1 && a == 35 && b == 3 && p == 29) || (n == 1 && a == 35 && b == 4 && p == 11) || (n == 1 && a == 37 && b == 4 && p == 13) || (n == 2 && a == 2 && b == 1 && p == 3) || (n == 2 && a == 2 && b == 2 && p == 2) || (n == 2 && a == 3 && b == 2 && p == 7) || (n == 2 && a == 3 && b == 3 && p == 3) || (n == 2 && a == 5 && b == 2 && p == 23) || (n == 2 && a == 5 && b == 3 && p == 19) || (n == 3 && a == 2 && b == 1 && p == 7) || (n == 3 && a == 2 && b == 3 && p == 2) || (n == 3 && a == 3 && b == 4 && p == 3) || (n == 3 && a == 5 && b == 5 && p == 5)

in several minutes (version 13.1 on Windows 10).

Addition.

Reduce[a^n == b! + p && 50 >= n > 0 && 40 >= a > 0 && 30 > p > 0 && p \[Element] Primes, {a, b, p}, Integers] 

(n == 1 && a == 3 && b == 0 && p == 2) || (n == 1 && a == 3 && b == 1 && p == 2) || (n == 1 && a == 4 && b == 0 && p == 3) || (n == 1 && a == 4 && b == 1 && p == 3) || (n == 1 && a == 4 && b == 2 && p == 2) || (n == 1 && a == 5 && b == 2 && p == 3) || (n == 1 && a == 6 && b == 0 && p == 5) || (n == 1 && a == 6 && b == 1 && p == 5) || (n == 1 && a == 7 && b == 2 && p == 5) || (n == 1 && a == 8 && b == 0 && p == 7) || (n == 1 && a == 8 && b == 1 && p == 7) || (n == 1 && a == 8 && b == 3 && p == 2) || (n == 1 && a == 9 && b == 2 && p == 7) || (n == 1 && a == 9 && b == 3 && p == 3) || (n == 1 && a == 11 && b == 3 && p == 5) || (n == 1 && a == 12 && b == 0 && p == 11) || (n == 1 && a == 12 && b == 1 && p == 11) || (n == 1 && a == 13 && b == 2 && p == 11) || (n == 1 && a == 13 && b == 3 && p == 7) || (n == 1 && a == 14 && b == 0 && p == 13) || (n == 1 && a == 14 && b == 1 && p == 13) || (n == 1 && a == 15 && b == 2 && p == 13) || (n == 1 && a == 17 && b == 3 && p == 11) || (n == 1 && a == 18 && b == 0 && p == 17) || (n == 1 && a == 18 && b == 1 && p == 17) || (n == 1 && a == 19 && b == 2 && p == 17) || (n == 1 && a == 19 && b == 3 && p == 13) || (n == 1 && a == 20 && b == 0 && p == 19) || (n == 1 && a == 20 && b == 1 && p == 19) || (n == 1 && a == 21 && b == 2 && p == 19) || (n == 1 && a == 23 && b == 3 && p == 17) || (n == 1 && a == 24 && b == 0 && p == 23) || (n == 1 && a == 24 && b == 1 && p == 23) || (n == 1 && a == 25 && b == 2 && p == 23) || (n == 1 && a == 25 && b == 3 && p == 19) || (n == 1 && a == 26 && b == 4 && p == 2) || (n == 1 && a == 27 && b == 4 && p == 3) || (n == 1 && a == 29 && b == 3 && p == 23) || (n == 1 && a == 29 && b == 4 && p == 5) || (n == 1 && a == 30 && b == 0 && p == 29) || (n == 1 && a == 30 && b == 1 && p == 29) || (n == 1 && a == 31 && b == 2 && p == 29) || (n == 1 && a == 31 && b == 4 && p == 7) || (n == 1 && a == 35 && b == 3 && p == 29) || (n == 1 && a == 35 && b == 4 && p == 11) || (n == 1 && a == 37 && b == 4 && p == 13) || (n == 2 && a == 2 && b == 0 && p == 3) || (n == 2 && a == 2 && b == 1 && p == 3) || (n == 2 && a == 2 && b == 2 && p == 2) || (n == 2 && a == 3 && b == 2 && p == 7) || (n == 2 && a == 3 && b == 3 && p == 3) || (n == 2 && a == 5 && b == 2 && p == 23) || (n == 2 && a == 5 && b == 3 && p == 19) || (n == 3 && a == 2 && b == 0 && p == 7) || (n == 3 && a == 2 && b == 1 && p == 7) || (n == 3 && a == 2 && b == 3 && p == 2) || (n == 3 && a == 3 && b == 4 && p == 3) || (n == 3 && a == 5 && b == 5 && p == 5)

The second answer is longer because of b==0 cases.

$\endgroup$
1
  • $\begingroup$ Note that n is omitted in {a, b, p}. $\endgroup$ Commented Jul 15, 2022 at 10:53

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.