Function NmodK has N inputs and a single output. Its output is one iff the binary number represented by the function input is divisible by the integer K. When the resulting function implementation passes the inputs through unchanged, NmodK function is a case of socalled Grover's oracle.
Every single output Boolean function can be extended to a minimal
reversible specification by the following procedure. Take the truth
table representation of this function illustrated below.
input

output 
Then, the truth table of its reversible specification is:
0 0 ... 0 
input 
output 
input 
1 1 ... 1 
input 
comple
mented output 
input 