Inspired by this CMC
Given a positive integer greater than 0, perform the following operation on it:
- If all ten single digits (
1234567890
) are in the number at least once, output the count and exit the program - Otherwise, double the number and repeat, incrementing the count.
The count starts at 0 and is the number of times the input was doubled. For example, if the input were 617283945, it would need to be doubled once because 1234567890 has all 10 digits in it.
This is a code-golf so shortest code wins. Input may be taken as a string, if you want.
Test cases
input => output
617283945 => 1
2 => 67
66833 => 44
1234567890 => 0
100 => 51
42 => 55
n
there exists somek
such thatnk
is pandigital? I'd love to see a proof. \$\endgroup\$ – shooqie Sep 14 '17 at 20:57