Count the number of remainders before next occurrence of ( n + 1 ) ' th ▁ ▁ remainder ▁ ' d '
$ count = 0 ; do { $ rem = ( 10 * $ rem ) % $ n ; $ count ++ ; } while ( $ rem != $ d ) ; return $ count ; }