Make last digit as highest prime less than given digit .
if ( prevprime [ ord ( N [ size - 1 ] ) - ord ( '0' ) ] + ord ( '0' ) != ord ( '0' ) ) : NEW_LINE INDENT ans [ size - 1 ] = prevprime [ ord ( N [ size - 1 ] ) - ord ( '0' ) ] + ord ( '0' ) ; NEW_LINE DEDENT