Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) Write a code (with the filename Q1.py) that will find and count 4-digit (from 1,000 to 10,000) Disarium numbers. (30p) Hint: A number will

image text in transcribed

1) Write a code (with the filename "Q1.py") that will find and count 4-digit (from 1,000 to 10,000) Disarium numbers. (30p) Hint: A number will be called DISARIUM if sum of its digits powered with their respective position is equal to the original number. abc which is a 3-digit number would be Disarium if abc = al + b2 + c3 abcd which is a 4-digit number would be Disarium if abcd = a1 + b + c3 + d4 For example 135 is a DISARIUM number because 11 + 32 + 53 135 For example 1306 is a DISARIUM number because 11 + 32 + 03 + 64 1306 = Hint-2: The number of 4-digit Disarium numbers is 3. Hint-3: 1306 is the smallest 4-digit Disarium number

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

=+-cach nonempty one contains a rational.

Answered: 1 week ago