Note that n≥5 and m and p have the same parity. If m is even then p=2 and we get 0≡4(mod8). Therefore, m and p both are odd. m3≡0,±1(mod7) and 2n≡2,4,1(mod7). Therefore, 2n≡1(mod7) and consequently n=3k: 23k−m3=7p2. We get (2k−m)(22k+2km+m2)=7p2.
Let gcd(2k−m,22k+2km+m2)=d. Since m is odd d also is odd. Since d divides (2k−m)2 and 22k+2km+m2, d divides 3⋅2km. If d divides m then since d also divides 2k−m we get that d divides 2k and consequently d=1. If d does not divide m then d=3.
Note that (2k−m<22k+2km+m2).
Case 1: d=1 and 2k−m=1, 22k+2km+m2=7p2. Plugging m=2k−1 into 22k+2km+m2=7p2 we get 3⋅22k−3⋅2k+1−7p2=0. Therefore k>1 and 1+p2≡0(mod4). No solution in this case.
Case 2: d=1 and 2k−m=7, 22k+2km+m2=p2. Plugging m=2k−7 into 22k+2km+m2=p2 we get 3⋅22k−21⋅2k+49=p2. Since d=1 p=7. In (mod7) left hand side takes 3⋅{2,4,1}={6,5,3} and right hand side takes {1,2,4}. No solution in this case.
Case 3: d=3 and 2k−m=p, 22k+2km+m2=7p. Readily p=d=3. Plugging 2k=m+3 into 22k+2km+m2=21 we get 3m2+9m−12=0. Therefore m=1 or m=−4. Since m is nonnegative we get m=1. Therefore, k=2 and n=6. The only solution is (6,1,3).