One possible way to do a serial could be the following:
So say you want the serial to be in the format of
aaaa-bbbb-cccc-dddd
1234-4567-8901-2345
You can then let it be a good serial if
a+2*b+3*c+5*d is in the range of (55000 to 55005) or something.
To generate them you could do something like the following which should give you a few good serials.
repeat 100000 times
--- set a to int(random(10000))
--- set b to int(random(10000))
--- set c to int(random(10000))
--- set d to int(random(10000))
------ a+b*2+c*3+d*5 is in the range (55000 to 55005)
--------- save as valid serial.