#include <stdio.h>
int main( int argc , char * argv[] ) {
int n , t;
scanf("%d" , &t);
while ( t-- ) {
scanf("%d" , &n);
int ans = 0;
int i = 0;
for ( i = 2 ; i <= n ; i++ ) {
ans = (ans + n + 1 - i) % i;
}
printf("%d\n" , ans+1);
}
return 0;
}
Arpit's Newsletter read by 15000+ engineers
🔥 Thrice a week, in your inbox, an essay about system design, distributed systems, microservices, programming languages internals, or a deep dive on some super-clever algorithm, or just a few tips on building highly scalable distributed systems.