Ad
  • Custom User Avatar

    @PBearson, your solution is wrong, because you need to check prime factors in range(start, end+1), not in range(start, end), because in Python range works as [start, end).

  • Custom User Avatar

    no random tests

  • Custom User Avatar

    I think you either mix factor with divisor, or your calculation is wrong:

    i      =  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...]
    S(i)   =  [0, 1, 1, 2, 1, 3, 2, 5, 3, 2, 3, ...]
    

    Let's take i = 8

    8 = 2 * 2 * 2  -->  largest factor = 2, so j = 2
    S(j-1) + S(j-2) = S(1) + S(0) = 1 + 0 = 1   <--  but you have 3 in your list
    

    however, if I use the largest divisor:

    8  -->  largest divisor = 4, so j = 4
    S(3) + S(2) = 3
    

    But the 2nd approach fails for your fixed tests 916 and 1521...