Write a Haskell function integerSqrt that returns the integer square root of a positive integer n. (The integer square root is defined to be the largest integer whose square is less than or equal to n, i.e. the result of integerSqrt 15 is 3.). integerSqrt :: Integer -> Integer
ANSWER:
AS PER THE QUESTION GIVEN
Haskell function
A program in Haskell which returns the integer square root of a positive integer n.
--function declaration
integerSqrt :: Int -> Int
--function definition
integerSqrt num = aux num
where
aux temp
| temp * temp > num = aux (temp -
1)
| otherwise = temp
main = do
-- display message
putStrLn "Integer square root is: "
--calling a function
print(integerSqrt 15)
The screenshot of the above code is given below:

OUTPUT:
Integer square root is:
3
IF YOU HAVE ANY DOUBTS COMMENT BELOW I WILL BE THERE TO HELP YOU
THANKS
Write a Haskell function integerSqrt that returns the integer square root of a positive integer n....
A positive integer n is “perfect” if the sum of its positive factors, excluding itself, equals n. Write a perfect function in Haskell that takes a single integer argument and returns the list of all perfect numbers up to that argument. Report all of the perfect numbers up to 1000 (i.e. call 1000)
Haskell Program: hailstone :: Integer -> Integer Given a positive integer n, return the length of the hailstone sequence beginning with n. The hailstone sequence for an integer n can be found by repeatedly applying a specific function. We will write e[i] for element i in the sequence, and define: e[0] = n e[i+1] = e[i] / 2, if e[i] is even e[i+1] = 3 * e[i] + 1, if e[i] is odd The sequence ends once e[i] is 1....
MATLAB Question:
TASK 5 12 MARKS -L06N] The rounded-square-root (RSR) of a positive integer n is defined as the square root of n rounded to the nearest integer. Adapting Heron's method to integer arithmetic allows the rounded-square-root of n to be calculated as follows. Let d be the number of digits of number n d-1 If d is odd, then Xo = 2 × 107- If d is even, then Xo-7 × 107- where xo is the starting guess for...
Write a recursive function named arithmeticSum that takes a positive integer parameter n and returns the sum of the integer numbers from 1 to n Please write in C++
IN PYTHON: Write a function that takes, as an argument, a positive integer n, and returns a LIST consisting of all of the digits of n (as integers) in the same order. Name this function intToList(n). For example, intToList(123) should return the list [1,2,3].
Haskell Function program Write a function negateOdds that takes a list of integers and returns a list of integers with all of the odd integers negated. negateOdds :: [Integer] -> [Integer] example: [1,2,3,4,5] should return [-1,2,-3,4,-5]
Convert the code you developed to obtain square root value into a function that returns square root of a float value argument. The answer is of float type. This function can be named sqrtC and it has one (float) parameter going in and one value (the result) coming out. Write code in C language.
Using python Write a Python function called sgm that requests a positive integer n and returns the series geometric mean of the numbers 1,2,3, . . . n. For example sgm(5) = (5 x 4 x 3 x 2 x 1)1/5 = (120) 1/5 = 2.605 . Write the program so that a user is requested for a positive integer and program prints the series geometric mean of the integer. Example execution: Enter number: 5 series geometric mean of 5...
1)
a) Write MATLAB function that accepts a positive integer
parameter n and returns a vector containing the values of the
integral (A) for n= 1,2,3,..., n. The function must use the
relation (B) and the value of y(1). Your function must preallocate
the array that it returns. Use for loop when writing your code.
b) Write MATLAB script that uses your function to calculate the
values of the integral (A) using the recurrence relation (B), y(n)
for n=1,2,... 19...
I got a C++ problem.
Let n be a positive integer and let S(n) denote the number of divisors of n. For example, S(1)- 1, S(4)-3, S(6)-4 A positive integer p is called antiprime if S(n)くS(p) for all positive n 〈P. In other words, an antiprime is a number that has a larger number of divisors than any number smaller than itself. Given a positive integer b, your program should output the largest antiprime that is less than or equal...