Prime numbers constraint

In reply to Shubhabrata:

Hi, I just found out this thread. My logic was mostly similar except I wasn’t using the
prime = g logic. I’m not entirely sure what/how does that work? Are you assigning value to a variable? Where are you returning that? I’m unfamiliar with this syntax of system verilog function.

Thanks