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

Обсуждение задачи 1132. Квадратный корень

I think that there is a simple formula that is going to
work....
> I think that there is a simple formula that is going to
> work....
I know the answer when (n mod 4)=3

The answer is +a^((n+1)/4), -a^((n+1)/4)

But I don't know the answer when (n mod 4)=1
an efficient algorithm for this problem requires knowing very much of number theory: Legendre Symbols and other (i've found them on the web). You could search the web for quadratic residues modulo n...
if not found, I cand send you "my" source...