Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

question 2 and 3 (2) [30 points) Write a function that determines if a positive integer is a decimal harshad (10-harshad) number. A positive, N-digit

image text in transcribedquestion 2 and 3

(2) [30 points) Write a function that determines if a positive integer is a decimal harshad (10-harshad) number. A positive, N-digit integer x written in base-10 (decimal), represented by x=dN110N1+dN210N2++a2102+d1101+d0100, is 10-harshad number if it is divisible by the sum of the digits: xmodi=0N1di=0. For example, all positive, single-digit integers less than ten are 10-harshad numbers. Also, 117 is 10harshad since 117 is divisible by 9 : 117mod(1+1+7)=117mod9=0. (a) The function must be named is_harshad verbatim. (b) The function must take a single non-negative integer as input and return a boolean True/False as output. 3. [30 points] Using your is_harshad function (do NOT rewrite or copy/paste your code), write a function that returns the first N 10-harshad numbers starting with 1. (a) The function must be named find_narcissistic verbatim. (b) The function must take a single non-negative integer N as input and return a list of the N integers. 4. [30 points] Write a function that estimates the Omega constant, which is the value of the real root of f(x;1), where f(x;a)=exxa, to sixteen decimal places using the fixed-point iteration, xn+1=xn+1+exexx using the initial guess x0=0. The root of f(x;a) is called the Lambert W function of a, which is defi as the root of the function implicit function xex=a so that Lambert W(a)=x. This function is also called the omega function or the product logar and appears frequently in the study of delay differential equations, quantum mechanics, and e kinetics. (a) The function must. be named compute_lambertW1_pi verbatim. b) The function will not take any parameters and will return a floating-point number as outp

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Carlos Coronel, Steven Morris

14th Edition

978-0357673034

More Books

Students also viewed these Databases questions

Question

=+Does it make you feel cool?

Answered: 1 week ago