Python: Dictionary: Prime Factors

Write a function which takes an integer n and returns its all prime factors as a dictionary. The keys of the dictionary are the prime factors and the values are the count for each prime factor.


prime_factors(5148) -> {2: 2, 3: 2, 11: 1, 13: 1}

Test 1    

Test 2    

Test 3    

Test 4    

Test 5    

Test 6