Category: Sequence and Series

Find subfactorial of a number

Given an integer N, the task is to find the subfactorial of the number represented as !N. The subfactorial of a number is defined using below recurrence relation of a number N:!N = (N-1) [ !(N-2) + !(N-1) ]where !1 = 0 and !0 = 1Some of the subfactorials are:n012345678910111213!n10129442651, 85414, 833133, 4961, 334, 96114, […]

Continue Reading

Mean of fourth powers of first N natural numbers

Mean of fourth powers of first N natural numbersGiven a positive integer N, the task is to find the average of the fourth powers of the first N natural numbers.Examples:Input: N = 3Output: 32.6667Explanation:Sum of the fourth powers of the first N natural numbers = 14 + 24 + 34 = 1 + 16 + […]

Continue Reading