Explain your code to someone else
Explain the code to rubber ducky
Comment your code
Name variables descriptively
Test early - try to break, and see if you can find inputs for which the program takes a long time
Separate your program into various functions that do specific things, and can be tested separately
First solve an easier case
N(log(26^12,2))
N(log(2^56,10))