ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Общий форум

what's the meaning of k-based number?
Послано tony002 1 авг 2004 19:39
I don't know what's the meaning of k-based number?
Re: what's the meaning of k-based number?
Послано Alexander Shulgin 2 авг 2004 16:02
Hello, Tony!

`The k-based number' means a representation of a number using `k' different digits (from `0' to `k-1').
For instance:
binary numbers are 2-based -- they consist of `0' and `1'. So, `101' is 2-based representation of decimal number `5'.
More generally: any number can be represented using formula:
x = a[n] * k^n + a[n-1] * k^(n-1) + ... + a[1] * k + a[0], where a[i] is the i-th digit of number `x' in k-based system: 0 <= a[i] < k; `k' is the base of the system.

5 = 1 * 2^2 + 0 * 2 + 1 (= 4 + 0 + 1), thus binary for `5' is `101'

or

255 = 3 * 8^2 + 7 * 8 + 7 (= 192 + 56 + 7), thus octal for `255' is `377'

and, surely,

15 = 1 * 10 + 5 (= 10 + 5), thus decimal for `15' is `15' :)

Alex

PS: if something is unclear, post further messages or email me: alexander.shulgin@yessoftware.com