Subtract dp [ len - 1 ] [ j ] for each factor of j from [ 1 , K ]
for y in range ( 1 , k + 1 , 1 ) : NEW_LINE INDENT dp [ x ] [ y ] = sum NEW_LINE for d in divisors [ y ] : NEW_LINE INDENT dp [ x ] [ y ] = ( dp [ x ] [ y ] - dp [ x - 1 ] [ d ] ) NEW_LINE DEDENT DEDENT