Here is the -BOr function:
And, here is the -BAnd function:function Show-BOr{param([Parameter(Mandatory = $true)][ValidateNotNullOrEmpty()][UInt32]$Max)$String = $null;for($i = 1; $i -le $Max; $i++){for($j = 1; $j -le $Max; $j++){if($j -ne $max){$String += "$($i -bor $j)`t"}else{$String += "$($i -bor $j)`n"}}}# Return results$string}
To use them, simply pass in a number. I find keeping it under 32 makes for decent output unless you write to a file.function Show-BAnd{param([Parameter(Mandatory = $true)][ValidateNotNullOrEmpty()][UInt32]$Max)$String = $null;for($i = 1; $i -le $Max; $i++){for($j = 1; $j -le $Max; $j++){if($j -ne $max){$String += "$($i -band $j)`t"}else{$String += "$($i -band $j)`n"}}}# Return results$string}
Here is a script iteration over a sample set of input values
And, here are the results:5,10,15 |ForEach-Object {Write $_Show-BOr -Max $_Show-Band -Max $_}
51 3 3 5 53 2 3 6 73 3 3 7 75 6 7 4 55 7 7 5 5 1 0 1 0 10 2 2 0 01 2 3 0 10 0 0 4 41 0 1 4 5 101 3 3 5 5 7 7 9 9 113 2 3 6 7 6 7 10 11 103 3 3 7 7 7 7 11 11 115 6 7 4 5 6 7 12 13 145 7 7 5 5 7 7 13 13 157 6 7 6 7 6 7 14 15 147 7 7 7 7 7 7 15 15 159 10 11 12 13 14 15 8 9 109 11 11 13 13 15 15 9 9 1111 10 11 14 15 14 15 10 11 10 1 0 1 0 1 0 1 0 1 00 2 2 0 0 2 2 0 0 21 2 3 0 1 2 3 0 1 20 0 0 4 4 4 4 0 0 01 0 1 4 5 4 5 0 1 00 2 2 4 4 6 6 0 0 21 2 3 4 5 6 7 0 1 20 0 0 0 0 0 0 8 8 81 0 1 0 1 0 1 8 9 80 2 2 0 0 2 2 8 8 10 151 3 3 5 5 7 7 9 9 11 11 13 13 15 153 2 3 6 7 6 7 10 11 10 11 14 15 14 153 3 3 7 7 7 7 11 11 11 11 15 15 15 155 6 7 4 5 6 7 12 13 14 15 12 13 14 155 7 7 5 5 7 7 13 13 15 15 13 13 15 157 6 7 6 7 6 7 14 15 14 15 14 15 14 157 7 7 7 7 7 7 15 15 15 15 15 15 15 159 10 11 12 13 14 15 8 9 10 11 12 13 14 159 11 11 13 13 15 15 9 9 11 11 13 13 15 15