Count numbers up to N that cannot be expressed as sum of at least two consecutive positive integers | C ++ 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
#include <bits/stdc++.h> NEW_LINE using namespace std ; void countNum ( int N ) { int ans = log2 ( N ) + 1 ; cout << ans << " STRNEWLINE " ; } int main ( ) { int N = 100 ; countNum ( N ) ; return 0 ; }