I did the code as stated not able to get all test cases pass so need a discussion what I am missing in this question also adding my code link :
https://hack.codingblocks.com/app/contests/3668/495/problem
You can go into submissions and see my logic code is self explainatory I feel, so please check.
Boston Problem in Oct-22 Batch Java Test cases failing
I got my mistake I was not doing prime factors digit sum so now code is working fine.