Rinish Patidar

Rinish Patidar

54 Articles Published

Articles by Rinish Patidar

Page 5 of 6

Find the GCD that lies in given range

Rinish Patidar
Rinish Patidar
Updated on 16-Mar-2023 760 Views

The problem states that we need to find the GCD that lies in the given range. We will be given two positive integers, x and y and two integers p and q which will be the range as [p, q]. We need to find out the GCD (greatest common divisor) of the numbers x and y falling under the range [p, q]. GCD, known as greatest common divisor in mathematics, is the greatest positive integer dividing each of two given positive integers. The given integers must not be zero. It is represented as gcd(x, y) for any two positive integers ...

Read More

Check whether a given number is Polydivisible or Not

Rinish Patidar
Rinish Patidar
Updated on 16-Mar-2023 483 Views

The problem statement includes checking whether a given number is Polydivisible or not for any given integer N. A polydivisible number, also known as magic number, is a number following a unique pattern. The number created by first p digits of the given number should always be divisible by p and there should not be any leading zeros in the given number. If a number satisfies these properties, it is a Polydivisible number, else it is not. Here, p should be in range (1, total digits in the given number). Let’s understand the concept of polydivisible number with an example: ...

Read More

Check if the n-th term is odd or even in a Fibonacci like sequence

Rinish Patidar
Rinish Patidar
Updated on 16-Mar-2023 455 Views

Our task in this problem is to check if the n-th term of a fibonacci like sequence is odd or even. A fibonacci sequence is a type of sequence in mathematics where each number in the sequence is the sum of the preceding two numbers. A nth term of the fibonacci sequence can be represented as − $$\mathrm{Fn\:=\:F_{n-1}\:+\:F_{n-2}}$$ The first few numbers of the fibonacci sequence are 0, 1, 1, 2, 3, 5, 8, 13, 21, 34….. The first two numbers of the sequence are 0 and 1. The next numbers are the sum of the preceding two ...

Read More

Centered Tridecagonal Number

Rinish Patidar
Rinish Patidar
Updated on 16-Mar-2023 295 Views

The problem statement states that we need to print the N-th centred Hexadecagon numbers for any positive number N. Tridecagonal numbers are the numbers that represent a tridecagon in itself. A tridecagon in mathematics is a polygon which has 13 sides. A centred tridecagonal numbers are the numbers that can be represented in the form of a dot in the centre followed by other dots surrounding it in successive layers of tridecagon which is nothing but a 13-sided polygon. Let’s understand the concept of centred tridecagonal numbers better with the figures. The first centred tridecagonal number can just ...

Read More

Centered Hexadecagonal Number

Rinish Patidar
Rinish Patidar
Updated on 16-Mar-2023 287 Views

Hexadecagonal numbers are the numbers that represent a hexadecagon. Hexadecagon is a polygon which consists of 16 sides. A Centred Hexadecagonal number is the number represented by a dot in the centre and other dots surrounding it in the successive hexadecagonal layers i.e. 16 sided polygon. We can understand the centred hexadecagonal number better with the below figures. There is a single dot in the centre for the first centred hexadecagon number. So the first centred hexadecagonal number will be 1. There is a single dot followed by a hexadecagon surrounding it in the next centred hexadecagon number. ...

Read More

Stormer Numbers

Rinish Patidar
Rinish Patidar
Updated on 14-Mar-2023 466 Views

For N to be a stormer number, the highest prime factor of the expression N^2+1 must be greater than or equal to 2*N and it should be a positive integer. For example, 4 is a stormer number. Since 4*4+1=17 has the greatest prime factor 17 itself which is greater than 8 i.e. 2*4. But 3 is not a stormer number because 3*3+1=10. The greatest prime factor of 10 is 5 which is less than 6 i.e. 2*3. In this problem, we are given a positive integer N and our goal is to print the first N stormer. INPUT: 4 ...

Read More

Print first n Fibonacci Numbers using Direct Formula

Rinish Patidar
Rinish Patidar
Updated on 14-Mar-2023 945 Views

In this article, we are going to solve the problem of printing first n Fibonacci Numbers using a direct formula. In mathematics, the fibonacci numbers often denoted by Fn (which indicates nth fibonacci number), form a series in which each number is equal to the sum of the preceding two numbers. The nth fibonacci number can be indicates as below − $$\mathrm{Fn\:=\:F_{n-1}\:+\:F_{n-2}}$$ The series begins with 0 and 1. The first few values in the fibonacci sequence, starting with 0 and 1 are − 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144. ...

Read More

Number of Ones in the Smallest repunit

Rinish Patidar
Rinish Patidar
Updated on 14-Mar-2023 432 Views

In this problem, we simply need to print the number of ones in the smallest repunit. A repunit is a positive number like 11, 111, or 1111 in recreational mathematics that only has the digit 1. A repunit is of the form $\mathrm{(10*n-1)/9}$ Example $\mathrm{(10*10-1)/9}$ gives 11. $\mathrm{(10*100-1)/9}$ gives 111. $\mathrm{(10*1000-1)/9}$ gives 1111. The above problem states that we are given any positive integer N with its unit digit 3 and we need to determine the smallest repunit that is divisible by the given number N. For example, If we are given N=13. Output: 6 N i.e. 13 perfectly divides ...

Read More

Multiply the given number by 2 such that it is divisible by 10

Rinish Patidar
Rinish Patidar
Updated on 14-Mar-2023 375 Views

This problem statement says that we are allowed to perform only one operation i.e. multiply the given number by 2 such that it is divisible by 10. We will be given a number say n. The only operation that we can perform on a given number is that we can multiply the given number by 2 until it is divisible by 10. We need to determine the minimum number of operations required to make the number such that it is divisible by 10 by repeatedly multiplying the given number n by 2. Else, print -1 if it is not possible ...

Read More

Minimum steps in which N can be obtained using addition or subtraction at every step

Rinish Patidar
Rinish Patidar
Updated on 14-Mar-2023 549 Views

From the above problem statement, our task is to get the minimum steps in which a given number N can be obtained using addition or subtraction at every step. We can understand that we need to print the minimum number of steps that we can perform and sequence of the steps on any given integer N to reach the number starting from 0 by addition or subtraction of the step number. In this problem set, we can add or subtract the number equal to the step count from the current location at each step. For instance, we can add either ...

Read More
Showing 41–50 of 54 articles
Advertisements