Maxim and Dividers
All submissions for this problem are available.
Read problems statements in Mandarin Chinese here
- Maxim likes dividers of the numbers. Also Maxim is fond of lucky numbers of small elephant from Lviv city.
If you remember, lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky, 5, 17, 467 — aren't.
Now Maxim is interested in the next information: what is the number of the integer positive dividers of number n, which are overlucky.
We call number overlucky if it is possible to remove some, but not all, digits and during bonding the remaining digits we will receive a lucky number. For example, number 72344 — overlucky, because it is possible to remove digits 2 and 3, and get number 744, which is lucky. Number 223 isn't overlucky.
- The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows. Single line of each test case contains an integer n.
- For each test case on different lines print the answer to the problem.
- 1 ≤ T ≤ 10
- 1 ≤ n ≤ 10^9
Input: 10 1 2 3 4 5 6 7 8 9 10 Output: 0 0 0 1 0 0 1 1 0 0
|Tags||divisors, number-theory, oct13, sereja, simple|
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions