This has no practical purpose but it could be fun to golf.
Challenge
Given a number n,
- Count the amount of each digit in n and add 1 to each count
- Take the prime factorization of n
- Count the amount of each digit in the prime factorization of n, without including duplicate primes
- Create a new list by multiplying together the respective elements of the lists from steps 1 and 3
- Return the sum of that list
For example, 121 has two 1s and a 2, so you would get the following list from step 1:
0 1 2 3 4 5 6 7 8 9 1 3 2 1 1 1 1 1 1 1 The prime factorization of 121 is 112, which gives the following list for step 3:
0 1 2 3 4 5 6 7 8 9 0 2 0 0 0 0 0 0 0 0 Note how we did not count the exponent. These multiply together to get:
0 1 2 3 4 5 6 7 8 9 0 6 0 0 0 0 0 0 0 0 And the sum of this list is 6.
Test cases
1 -> 0 2 -> 2 3 -> 2 4 -> 1 5 -> 2 10 -> 2 13 -> 4 121 -> 6 Notes
- Standard loopholes are forbidden.
- Input and output can be in any reasonable format.
- You should leave ones (or zeros for step 3) in the list for digits that did not appear in the number.
- This is code-golf, so the shortest solution in bytes wins.
232792560->[2,1,4,2,1,2,2,2,1,2](step 1);2*2*2*2*3*3*5*7*14*17*19(step 2); so[0,5,1,2,0,1,0,2,0,1](step 3); then[0,5,4,4,0,2,0,4,0,2](Step 4); and hence should output21. \$\endgroup\$