Category: Numbers

Convert given Complex Numbers into polar form and perform all arithmetic operations

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 = […]

Continue Reading

Number of subarrays consisting only of Pronic Numbers

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, […]

Continue Reading

Sum of Fibonacci Numbers | Set 2

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 […]

Continue Reading