Предмет: Информатика, автор: Женя4432

Число 121 с основанием n записано в системе счисления с основанием n (n>1). Определите наибольшее возможное значение n, для которого 121 c основанием n<108 с основанием 10. Для этого значения n в ответе напишите представление данного числа в десятичной системе счисления. ПОМОГИТЕ ПЖ! 30 БАЛЛОВ!
С РЕШЕНИЕМ ИЛИ ОБЪЯСНЕНИЕМ!!


ksuffkevich: вот здесь https://youtu.be/JUQA8OLVAfU еще есть видео-разбор метода решения в ручную (2 способа: через неравенство и без)

Ответы

Автор ответа: Vovchik04
4

Ответ:

9

Объяснение:

number = '121'

N = 0

for n in range(3, 10):

   if int(number, n) < 108:

       N = n

   else:

       break

print(N)

Изначально у нас есть число 121

Цикл перебирает переводы 121 из системы n в 10, где n - число от 3 (потому что содержится цифра 2, которой нет в 2 системе) до 10 невключительно

Если число с основанием n при переводе в 10 меньше 108, то обновляем переменную N, иначе выходим из цикла и получаем последнее значение, удовлетворяющее условию.

В данном случае подошли все значения до 9 (121_{9} = 100_{10})


Женя4432: это питон?
Vovchik04: Это питон
Похожие вопросы
Предмет: Английский язык, автор: nfjkfnk
ПОСТАВЬТЕ ГЛАГОЛЫ В НУЖНОЕ ВРЕМЯ ПОЖАЛУЙСТА ОЧЕНЬ СРОЧНО100 БАЛЛОВ!!!
We 1) _________ (visit) the Marple Hotel in July 2002, when we 2) _______(decide) that we would not feature the hotel in our brochure. There 3) __________ (be) a number of reasons for this: the rooms 4) ________ (need) upgrading, we 5) _______ (feel) that the stan­dard of service 6) _______(not/be) good enough, and the hotel 7) __________ (not seem) to be well managed.

However, a great deal 8)_________ (change) since 2002, and the hotel is now under new management. They 9) _________ (redecorate) all the rooms and they 10) ___________ (make) the restaurant much more comfortable and attractive.

They 11) ____________ (also/build) a new pool. They 12) ________ (start) work on a new extension which1 should be complete by April next year, and this will bring the number of available rooms to 200. The new manager 13) __________ (introduce) an incentive scheme for the staff, 14) (increase) salaries, and 15) _________(send) a number of employees on training courses, and as a result the level of service 16) _________ (improve) a great deal.

The restaurant is gaining a good reputation. The new chef 17) _________ (be) at the hotel for three months, and will clearly maintain high standards of cuisine. He 18) __________ (train) in Paris a few years ago, and then 19) _________ (work) at the Tour d'Argent. Since his ar­rival, he 20) _________ (create) a new menu and 21) ________ (hire) a new maitre d'hotel to train the waiters. We 22) _________ (have) a meal at-the restaurant last night and 23) ________ (think) the standards were excellent.

We therefore recommend that we feature the Marple Hotel in next year's brochure.
100 БАЛЛОВ!!!