A computer-implemented method for counting events (102, 402), the method comprising: resetting a set of quantum registers; applying a Hadamard operator to the set of quantum registers; executing a quantum instruction on the set of quantum registers, wherein the quantum instruction incorporates a function for an event vector (114, 406) comprising events (102, 402) identified by bits (116, 404), wherein said function is as follows: f x = ∧ i = 1 n x i E i wherein Λ denotes Boolean AND, the factor Λ i = 1 n x i E i denotes the Boolean AND of all components of x where events are present, E i is an ith bit in the event vector (114, 406), n is a number of bits (116, 404) in the event vector (114, 406), X i is the ith bit in the quantum register, and i is an index value, said quantum instruction being defined by U f = ∑ x ∈ 0,1 L E ∑ y ∈ 0,1 1 | x 〉 〈 x | ⊗ | y ⊕ f x 〉 〈 y | where x is an n qbit value, y a single qbitindex value, f(x) is the function based on the event vector, and L is a length of the event vector (114, 406); applying the Hadamard operator to the set of quantum registers after executing the quantum instruction; measuring the set of quantum registers to form a measurement of the set of quantum registers; and determining an approximate count of the events (102, 402) using the measurement of the set of quantum registers, wherein determining the approximate count of the events (102, 402) using the measurement of the set of quantum registers comprises: determining the approximate count of the events (102, 402) as follows: C E = F − 1 C r / M where C(r) is a count of logic ones in a measurement vector in the measurement, M is a number of quantum registers and F -1 is an inverse of F(c) which is as follows: F c = ∑ i = c + 1 L E 2 i / 2 n 2 where i is an index value, n is a number of qbits, c is an event count. resetting a set of quantum registers; applying a Hadamard operator to the set of quantum registers; executing a quantum instruction on the set of quantum registers, wherein the quantum instruction incorporates a function for an event vector (114, 406) comprising events (102, 402) identified by bits (116, 404), wherein said function is as follows: f x = ∧ i = 1 n x i E i wherein Λ denotes Boolean AND, the factor Λ i = 1 n x i E i denotes the Boolean AND of all components of x where events are present, E i is an ith bit in the event vector (114, 406), n is a number of bits (116, 404) in the event vector (114, 406), X i is the ith bit in the quantum register, and i is an index value, said quantum instruction being defined by U f = ∑ x ∈ 0,1 L E ∑ y ∈ 0,1 1 | x 〉 〈 x | ⊗ | y ⊕ f x 〉 〈 y | where x is an n qbit value, y a single qbitindex value, f(x) is the function based on the event vector, and L is a length of the event vector (114, 406); applying the Hadamard operator to the set of quantum registers after executing the quantum instruction; measuring the set of quantum registers to form a measurement of the set of quantum registers; and determining an approximate count of the events (102, 402) using the measurement of the set of quantum registers, wherein determining the approximate count of the events (102, 402) using the measurement of the set of quantum registers comprises: determining the approximate count of the events (102, 402) as follows: C E = F − 1 C r / M where C(r) is a count of logic ones in a measurement vector in the measurement, M is a number of quantum registers and F -1 is an inverse of F(c) which is as follows: F c = ∑ i = c + 1 L E 2 i / 2 n 2 where i is an index value, n is a number of qbits, c is an event count.