Mistake in expanding binomial theorem
If $w$ denotes the power, your congruences assume that the binomial coefficients $\binom{w}{k}$ are all zero mod $w$ for $1 \le k \le w-1.$ This is true when the exponent $w$ is prime, but your eponent is $(p-1)(pk-1)$ for $p$ a prime. That exponent is not prime except when $p=2,k=2.$ In that one case the exponent is $3.$ Note in that case your congruence says $27 \equiv 3 $ mod $2$ which is right.