comparison mod7.nsb @ 105:bf6d6304f6f7

Add files via upload committer: GitHub <noreply@github.com>
author Paper <37962225+mrpapersonic@users.noreply.github.com>
date Tue, 18 Oct 2022 17:32:24 -0400
parents
children 66dc98750bc4
comparison
equal deleted inserted replaced
104:2e115eb60be8 105:bf6d6304f6f7
1 {if:{argslen}|=|1|then:{
2 if:{arg:0}|=|--oem|then:{choose:95|96|97|98|99|00|01|02|03}{range:100|365}-OEM-{lua:
3 function sumdigits(n)
4 local sum = 0
5 while n > 0 do
6 sum = sum + n%10
7 n = math.floor(n/10)
8 end
9 return sum
10 end
11
12 the = 1
13 while (sumdigits(the) % 7 ~= 0) do
14 the = (math.random(1, 99999)*10)+math.random(1,7)
15 end
16 print(string.format("%07d", the))
17 }-{range:10000|99999}|else:
18 {set:first|{range:111|999}}{
19 if:{get:first}|=|333|then:{set:first|332}}{
20 if:{get:first}|=|444|then:{set:first|443}}{
21 if:{get:first}|=|555|then:{set:first|554}}{
22 if:{get:first}|=|666|then:{set:first|665}}{
23 if:{get:first}|=|777|then:{set:first|776}}{
24 if:{get:first}|=|888|then:{set:first|887}}{
25 if:{get:first}|=|999|then:{set:first|998}}{get:first}{
26 if:{arg:0}|=|--office|then:{
27 if:{substring:{get:first}|2|3}|=|9|then:0|else:{len:{repeat:{substring:{get:first}|2|3}|a}{repeat:1|a}}}}-{lua:
28 the = 1
29 while (the % 7 ~= 0) do
30 the = (math.random(1, 999999)*10)+math.random(1,7)
31 end
32 print(string.format("%07d", the))
33 }}
34 |else:`.t mod7 <--normal> OR <--office> OR <--oem>`}