Mathematics
Mathematics, 24.11.2021 04:10, yasarhan2

Babylonians use regular numbers to keep time. A regular number in math is defined to be a number that is a factor of some power of 60 (60, 3600, etc). Equivalently we can say that a regular number is one whose ONLY prime divisors are 2, 3 and 5. The first 10 regular numbers are: 1, 2, 3, 4, 5, 6, 8, 9, 10, 12. Your task is to compute the n-th regular number. Hint as a possible algorithm: 1. Use a priority queue.
2. The regular numbers are 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24, 25, 27, 30, ...
Note that other than 1, each number in the sequence can be generated by some previous number in the sequence by multiplying that previous number by a 2, 3, or 5. So you start with offering a 1 to the priority queue, then you poll the priority queue. Now with this 1 retrieved (which is the 1st regular number), you generate a few regular numbers and offer them back to the priority queue. Repeat the process and retrieve the numbers. The n-th number retrieved is the answer. Grading metric: some effort 2 points significant effort 5 points Each solved case is additional 1 point (there are 5 test cases). Write to the console the answer of these 5 test cases 1. the 10th regular number 2. the 50th regular number 3. the 100th regular number 4. the 200th regular number 5. the 300th regular number.

answer
Answers: 3

Other questions on the subject: Mathematics

image
Mathematics, 21.06.2019 20:30, leeshaaa17
Which expression demonstrates the use of the commutative property of addition in the first step of simplifying the expression (-1+i)+(21+5i)+0
Answers: 2
image
Mathematics, 22.06.2019 02:30, ladypink94
P= price tax is 4% added to the price. which expression shows the total price including tax?
Answers: 3
image
Mathematics, 22.06.2019 04:30, sickboi
Jocelyn estimates that a piece of wood measures 5.5 cm. if it actually measures 5.62 cm, what is the percent error of jocelyn’s estimate? a. 2.13% b. 2.18% c. 12% d. 46.83%
Answers: 1
image
Mathematics, 22.06.2019 05:00, Dweath50
Two trains leave a station on different tracks. the tracks make an angle of 130°, with the station as a vertex. the first train travels 100 km and makes its first stop at point a, while the second train travels 200 km and makes it first stop at point b. how far apart are the trains when both are at their first stop? round the answer to the nearest integer. a) 65 km b) 139 km c) 224 km d) 275 km
Answers: 2
Do you know the correct answer?
Babylonians use regular numbers to keep time. A regular number in math is defined to be a number tha...

Questions in other subjects:

Konu
Mathematics, 07.02.2021 14:00