human
Number of ones in the smallest repunit | Function to find number of 1 s in smallest repunit multiple of the number.
to store number of 1 s in smallest repunit multiple of the number ..
initialize rem with 1.
run loop until rem becomes zero.
rem * 10 + 1 here represents the repunit modulo n.
when remainder becomes 0 return count.
Driver Code.
Calling function"
How can the above be solved in Python?
assistant
#Here is code to number of ones in the smallest repunit and the other steps required.
 def countOnes ( n ) :
	count = 1 ;
	rem = 1 ;
	while ( rem != 0 ) :
		rem = ( rem * 10 + 1 ) % n ;
		count = count + 1 ;
	return count ;
n = 13 ;
print ( countOnes ( n ) ) ;