1
1
1Tima12020-05-14 18:56:40
Mathematics
1Tima1, 2020-05-14 18:56:40

How to make an algorithm?

I was given a task - The smallest divisor of a number other than 1 will be called the minimum. The largest divisor of a number, other than the number itself, will be called the maximum. Find a four-digit number whose maximum divisor is 91 times the minimum. It suffices to give an example of one such number. The correct answer is 2275
In general, this is a math problem. But I cheated a little, because it was not in vain that I learned a programming language!?
But I left all the routine work to the machine - that is, the bulkhead. But as you guessed, these had to be done by yourself, which means making some kind of equation or other method other than enumeration.
Any ideas?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2020-05-14
@1Tima1

Since we are talking about divisors, we need to consider only prime numbers.
999 < x * (91 * x) < 10000
999/91 < x 2 < 10000/91
3.313 < x < 10.483
x is a prime number
Solutions are 5 and 7
5 * (91 * 5) = 2275
7 * (91 * 7 ) = 4459

M
Mercury13, 2020-05-14
@Mercury13

Let the minimal prime divisor be a.
Then the minimum divisor is a (if the min. divisor is composite, there would be a smaller one), the maximum is x/a (for a similar reason), x=91 a².
In addition, 91 = 7 13, and therefore a <= 7.
2² 91 and 3² 91 are clearly not up to four digits.
But the following - a=5 - gives 2275 = 5² 7 13.
A=7, x=7³ 13=4459 should also work.
(Since there is mathematics here, even a calculator is often forbidden, so I tried to write it the way a person without a calculator would think)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question