아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Halfway There

시간 제한2초메모리 제한512 MB

요약
n이 주어질 때마다 1부터 n-1까지 n과 서로소인 정수들의 중앙값을 구한다.
난이도

보통10점 중 7점

유형
정수론, 수학
정답자
아직 제출이 없습니다

문제

Given an integer nn, find the median of the list of all integers from 11 to n−1n - 1 that are coprime with nn.

Recall that integers aa and bb are called coprime if their greatest common divisor is 1. The median of a list LL is defined to be the ∣L∣2\frac {|L|}{2}-th element of LL if ∣L∣|L| is even, and the ∣L∣+12\frac {|L|+1}{2}-th element of LL if ∣L∣|L| is odd. Here LL is assumed to be sorted in ascending order, ∣L∣|L| denotes the length of LL, and indices are 11-based.

입력

Each test contains multiple test cases. The first line contains the number of test cases tt (1≤t≤1031 \le t \le 10^3). Description of the test cases follows.

The only line of each test case contains a single integer nn (2≤n≤10182 \le n \le 10^{18}).

출력

For each test case, print a single integer --- the median of the list of integers from 11 to n−1n - 1 that are coprime with nn.

예제1

  1. 예제 1

    입력
    3
    6
    10
    19
    
    예상 출력
    1
    3
    9