Count numbers up to N that cannot be expressed as sum of at least two consecutive positive integers | Python 3 program for the above approach ; Function to count numbers that cannot be expressed as sum of two or more consecutive + ve integers ; Stores the count of such numbers ; Driver Code
import math NEW_LINE def countNum ( N ) : NEW_LINE INDENT ans = int ( math . log2 ( N ) ) + 1 NEW_LINE print ( ans ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT N = 100 NEW_LINE countNum ( N ) NEW_LINE DEDENT