Anybody have thoughts on generating a row of a truth table with out creating the entire table. For example, a user would enter in a row number and that truth table row is generated. Also, this should be done without creating the table until you get to that row number. Essentially, I want to know if there is an efficient way to calculate a truth row value only based on a the truth table row as an input.
Example: Assume 3 variables printTruthTableRow(3) would produce 010
Actually, could I just convert the input-1 to a binary value to get that truth table row?
EDIT: Let me give you guys a little more background. I am wrote a basic DPLL SAT Solver in Java. My goal is to have a bunch of threads run the solver to solve the n-Queen problem. Currently, my algorithm generate a row of a truth table, one at a time, then feeds it to a thread to solve. The problem is that my truth table generation cannot be done concurrently by the threads. If a thread grabs a truth table row, it must lock the method, generate a row, and then unlock. I can increase speedup if less work is done when generating a truth table row. I can just convert an atomic count value to binary and have the thread test that. Thank you all for the answers.
Would the first row be row 0 or 1? If 0 then you'd basically just have to convert the row number to its binary representation, e.g. if you have 3 boolean variables do something like
0 -> 0 0 0
1 -> 0 0 1
2 -> 0 1 0
3 -> 0 1 1
...
Then use those bits and your truth function to calculate the result.