Lucía multiplies some positive one-digit numbers (not necessarily distinct) and obtains a number n greater than 10. Then, she multiplies all the digits of n and obtains an odd number. Find all possible values of the units digit of n.
Call the 1-digit integers selected for multiplication: d1, d2, ..., di, ... etc.
product(di) = n
Since pod(n) is odd, all the digits of n must be odd including the last one. Thus n is odd. But this also means all the di are odd.
So d1, d2, etc all come from {1,3,5,7,9}
A program which randomly samples from the 1-digit odd numbers and applies the procedure to anywhere from 2 to 9 individual di finds that the final digit or units digit of n can only be 5.
-------------
import random
unitsDigits = []
digits = [i for i in range(10)]
for numOfnums in range(2,10):
for rep in range(100):
tobemults = [random.choice((1,3,5,7,9)) for i in range(numOfnums)]
myprod = product(tobemults)
x = pod(myprod)
if x%2 == 0 or x < 10:
continue
d = x%10
if d not in unitsDigits:
unitsDigits.append(d)
print()
print(sorted(unitsDigits))
Output: [5]
|
Posted by Larry
on 2024-05-24 09:20:55 |