Skip to main content
1 of 2
Robert Israel
  • 54.2k
  • 1
  • 76
  • 152

Write your equation as

$$ s = 2 - \dfrac{2(2^p-1)}{n} + \dfrac{2^{p+1}-4}{n-1}$$

Since $\gcd(n,n-1) = 1$, we need $n$ to divide $2(2^p-1)$ and $n-1$ to divide $2^{p+1} -4$.

$n = 3$ works for any even $p$, with $s = (2^p+2)/3$.

$n=5$ works for $p$ divisible by $4$, with $s = (2^p + 14)/10$.

$n = 7$ works for $p \equiv 3 \mod 6$.

$n = 15$ works for $p \equiv 4 \mod 12$.

$n = 23$ works for $p \equiv 11 \mod 110$.

$n = 29$ works for $p \equiv 28 \mod 84$.

$n = 31$ works for $p \equiv 5 \mod 20$.

etc.

Robert Israel
  • 54.2k
  • 1
  • 76
  • 152