Question

The integer 145 has the curious property that 145 = 1! + 4! + 5!It is...

The integer 145 has the curious property that 145 = 1! + 4! + 5!It is possible to prove mathematically that there is no integer greater than 200,000 with this property. There is only one whole number (integer) other than 1, 2, and 145 which has this property. Write a function, curious_property, which finds this number

Homework Answers

Answer #1

MATLAB Script:

close all
clear
clc

curious_property()

function curious_property()
fprintf('Numbers with Curious Property:\n')
for i = 1:200000
list = []; % List for storing each digit of a number
x = i;
while true
list = [list, rem(x,10)]; % Keep storing the remainders (individual digits of a number)
if x < 10
break
end
x = floor(x/10);
end
if sum(factorial(list)) == i % Curious property
fprintf('\t%d\n', i)
end
end
end

Output:

Numbers with Curious Property:
   1
   2
   145
   40585

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
4. Prove that if p is a prime number greater than 3, then p is of...
4. Prove that if p is a prime number greater than 3, then p is of the form 3k + 1 or 3k + 2. 5. Prove that if p is a prime number, then n √p is irrational for every integer n ≥ 2. 6. Prove or disprove that 3 is the only prime number of the form n2 −1. 7. Prove that if a is a positive integer of the form 3n+2, then at least one prime divisor...
An integer 'n' greater than 1 is prime if its only positive divisor is 1 or...
An integer 'n' greater than 1 is prime if its only positive divisor is 1 or itself. For example, 2, 3, 5, and 7 are prime numbers, but 4, 6, 8, and 9 are not. Write a python program that defines a function isPrime (number) with the following header: def isPrime (number): that checks whether a number is prime or not. Use that function in your main program to count the number of prime numbers that are less than 5000....
Prove that a natural number m greater than 1 is prime if m has the property...
Prove that a natural number m greater than 1 is prime if m has the property that it divides at least one of a and b whenever it divides ab.
4) Let F be a finite field. Prove that there exists an integer n ≥ 1,...
4) Let F be a finite field. Prove that there exists an integer n ≥ 1, such that n.1F = 0F . Show further that the smallest positive integer with this property is a prime number.
Activity 6.6. (a) A positive integer that is greater than 11 and not prime is called...
Activity 6.6. (a) A positive integer that is greater than 11 and not prime is called composite. Write a technical definition for the concept of composite number with a similar level of detail as in the “more complete” definition of prime number. Note. A number is called prime if its only divisors are 1 and itself. This definition has some hidden parts: a more complete definition would be as follows. A number is called prime if it is an integer,...
5. (26pts) Consider the following scenario: Process 0 is responsible for generating a random integer for...
5. (26pts) Consider the following scenario: Process 0 is responsible for generating a random integer for the other processes to use. Each random number can be used by only one process. The random number can be passed to the other processes through an integer. The integer can be considered to be in one of two states. The integer is “empty” if Process 0 has not yet generated a random number or if the random number had been used by a...
Write the following in C: 2. An integer is said to be prime if it is...
Write the following in C: 2. An integer is said to be prime if it is divisible by only 1 and itself. Write a function called prime() that takes in one integer number, and returns 1 (true) if the number is prime and 0 (false) otherwise. Write a program to generate six random numbers between 1 to 100 and calls function prime() on each one to determine if it is prime or not.
A prime number is an integer greater than 1 that is evenly divisible by only 1...
A prime number is an integer greater than 1 that is evenly divisible by only 1 and itself. For example, 2, 3, 5, and 7 are prime numbers, but 4, 6, 8, and 9 are not. Create a PrimeNumber application that prompts the user for a number and then displays a message indicating whether the number is prime or not. Hint: The % operator can be used to determine if one number is evenly divisible by another. ( Java programing...
/* This program should check if the given integer number is prime. Reminder, an integer number...
/* This program should check if the given integer number is prime. Reminder, an integer number greater than 1 is prime if it divisible only by itself and by 1. In other words a prime number divided by any other natural number (besides 1 and itself) will have a non-zero remainder. Your task: Write a method called checkPrime(n) that will take an integer greater than 1 as an input, and return true if that integer is prime; otherwise, it should...
1. The Fundamental Theorem of Arithmetic states: Every integer greater than or equal to 2 has...
1. The Fundamental Theorem of Arithmetic states: Every integer greater than or equal to 2 has a unique factorization into prime integers. Prove by induction the uniqueness part of the Fundamental Theorem of Arithmetic.
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT