Saturday, 4 Dec 2021
Category: Numbers

Count numbers up to N that cannot be expressed as sum of at least two consecutive positive integersGiven a positive integer N, the task is to find the count of integers from the range [1, N] such that the integer cannot be expressed as sum of two or more consecutive positive integers.Examples:Input: N = 10Output: […]

import math    def get_polar_form(z):               re, im = z             r = (re * re + im * im) ** 0.5             if r:         theta = math.asin(im / r)         return (r, theta)                   else:         return (0, 0)    def Addition(z1, z2):               r1, theta1 = z1     r2, theta2 = […]

Number of subarrays consisting only of Pronic Numbers Given an array arr[] consisting of N positive integers, the task is to count the number of subarrays consisting only of pronic numbers. Examples: Input: arr[] = {5, 6, 12, 3, 4}Output: 3Explanation: The subarray that consists only of pronic numbers are: {6} {12} {6, 12} Therefore, […]

Sum of Fibonacci Numbers | Set 2 Given a positive number N, the task is to find the sum of the first (N + 1) Fibonacci Numbers. Examples: Input: N = 3Output: 4Explanation:The first 4 terms of the Fibonacci Series is {0, 1, 1, 2}. Therefore, the required sum = 0 + 1 + 1 […]