How do we get to know about the algo

how do we get to know about the algo that it is getting replaced by 10^(rem-1), is t just hit and trial because that is very difficult or else what logic