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$
9
  • 2
    $\begingroup$ Your code gave me 172 solutions (Version 13.1, Mac M1): i.stack.imgur.com/nmikC.jpg $\endgroup$
    – Michael E2
    Jul 13 at 22:40
  • $\begingroup$ @MichaelE2 The unique solutions are (2, 2, 2) and (3, 4, 3). $\endgroup$ Jul 13 at 22:48
  • 1
    $\begingroup$ What about a == 12 && b == 3 && p == 6? It seems to work (for n == 1). $\endgroup$
    – Michael E2
    Jul 13 at 23:24
  • 2
    $\begingroup$ v=Partition[Flatten[Table[{a,b,n,p},{a,1,40},{b,1,29},{n,1,50},{p,1,29}]],4]; Select[v,({a,b,n,p}=#;a^n==b!+p)&] gives 136 solutions, but that includes n in those solutions. $\endgroup$
    – Bill
    Jul 13 at 23:30
  • 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$
    – Akku14
    Jul 15 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$
    – user64494
    Jul 15 at 10:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.