Numbers
Given N non-negative integers, we are interested in examining their pairwise sums, resulting in a total of N^2 sums.
For each digit position from 0 to K, we need to determine how many times the digit one appears in that position across all these sums.
Input
You will be provided with the integers N, K, P, and Q where (0 ≤ N ≤ 10^7, 1 ≤ K ≤ 24, 1 ≤ P, Q ≤ 10^9+7, and both P and Q are prime numbers). The sequence of numbers a_0, ..., a_{N-1} is generated using the following formula: a_0 = 1, and for each subsequent number, a_{i+1} = (a_i·P+Q) mod 2^K.
Output
On the first line, output K+1 integers, which represent the counts of ones in each digit position. Start with the least significant digit. Note that it is only necessary to output the counts for the first K+1 positions, as any further positions would only contain zeros.