Creating an IMPROPER multiplication table(learning how to use And command)?

I have a multiplication table I want to create, but I want it be to be wrong.. Meaning that for the products of numbers that are EVEN, I actually want the answer to be that product + 1. So 44 = 16+1 = 17, 22 = 4+1 =5 and so on for all the even numbers. The odd numbers can stay the same. I’m trying to learn how to use the “And” command in this process. I have some temporary code:

TableForm[Table[a*b, {a, 12}, {b, 12}], TableHeadings -> Automatic]

This code produces a proper multiplication table, but I am having trouble determining where to insert And(&&) so that I can manipulate the products of those even numbers.

Any suggestions? I think the command OddQ might help also

What about

TableForm[Table[If[OddQ[a*b], a*b, a*b + 1], {a, 12}, {b, 12}], TableHeadings -> Automatic]

or

TableForm[Table[a*b, {a, 12}, {b, 12}] /. x_ /; EvenQ[x] -> x + 1 , TableHeadings -> Automatic]

Cheers,

Marco

Oh! I like that Marco.

I find it so cool and useful to be able to produce the same outputs using different types of inputs/commands.

I appreciate your method

Brandon

Glad to help. Here’s another one - this time without an explicit if-condition:

TableForm[Table[a*b + Mod[a *b + 1, 2], {a, 12}, {b, 12}], TableHeadings -> Automatic]

M.