I've found such numbers time and time again in verilog and digital logic exercises, but I don't know how I'm supposed to know what number this is or how to write it as 12'b in verilog code.
Can someone explain them to me?
The number referred to in the post is called a literal constant or a number literal or just a literal.
There is a tutorial document with examples that is a good reference on the subject.
The document can be found here:
/verilog_number_literals