Mercurial > codedump
comparison mod7.nsb @ 107:96e5d721538f
Update mod7.nsb
committer: GitHub <noreply@github.com>
author | Paper <37962225+mrpapersonic@users.noreply.github.com> |
---|---|
date | Tue, 18 Oct 2022 19:23:05 -0400 |
parents | 66dc98750bc4 |
children |
comparison
equal
deleted
inserted
replaced
106:66dc98750bc4 | 107:96e5d721538f |
---|---|
1 {if:{argslen}|=|1|then:{ | 1 {if:{argslen}|=|1|then:{ |
2 if:{arg:0}|=|--oem|then:{choose:95|96|97|98|99|00|01|02|03}{set:day|{range:1|365}}{repeat:{len:{substring:{repeat:3|a}|{len:{get:day}}}}|0}{get:day}-OEM-{lua: | 2 if:{arg:0}|=|--oem|then:{set:day|{range:1|365}}{repeat:{len:{substring:{repeat:3|a}|{len:{get:day}}}}|0}{get:day}{choose:95|96|97|98|99|00|01|02|03}-OEM-{lua: |
3 function sumdigits(n) | 3 function sumdigits(n) |
4 local sum = 0 | 4 local sum = 0 |
5 while n > 0 do | 5 while n > 0 do |
6 sum = sum + n%10 | 6 sum = sum + n%10 |
7 n = math.floor(n/10) | 7 n = math.floor(n/10) |
9 return sum | 9 return sum |
10 end | 10 end |
11 | 11 |
12 the = 1 | 12 the = 1 |
13 while (sumdigits(the) % 7 ~= 0) do | 13 while (sumdigits(the) % 7 ~= 0) do |
14 the = (math.random(1, 99999)*10)+math.random(1,7) | 14 the = math.random(1, 99999) |
15 end | 15 end |
16 the = (the*10)+math.random(1,7) | |
16 print(string.format("%07d", the)) | 17 print(string.format("%07d", the)) |
17 }-{set:day|{range:1|99999}}{repeat:{len:{substring:{repeat:5|a}|{len:{get:day}}}}|0}{get:day}|else: | 18 }-{set:day|{range:1|99999}}{repeat:{len:{substring:{repeat:5|a}|{len:{get:day}}}}|0}{get:day}|else: |
18 {set:first|{range:111|999}}{ | 19 {set:first|{range:111|999}}{ |
19 if:{get:first}|=|333|then:{set:first|332}}{ | 20 if:{get:first}|=|333|then:{set:first|332}}{ |
20 if:{get:first}|=|444|then:{set:first|443}}{ | 21 if:{get:first}|=|444|then:{set:first|443}}{ |
23 if:{get:first}|=|777|then:{set:first|776}}{ | 24 if:{get:first}|=|777|then:{set:first|776}}{ |
24 if:{get:first}|=|888|then:{set:first|887}}{ | 25 if:{get:first}|=|888|then:{set:first|887}}{ |
25 if:{get:first}|=|999|then:{set:first|998}}{get:first}{ | 26 if:{get:first}|=|999|then:{set:first|998}}{get:first}{ |
26 if:{arg:0}|=|--office|then:{ | 27 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 if:{substring:{get:first}|2|3}|=|9|then:0|else:{len:{repeat:{substring:{get:first}|2|3}|a}{repeat:1|a}}}}-{lua: |
29 function sumdigits(n) | |
30 local sum = 0 | |
31 while n > 0 do | |
32 sum = sum + n%10 | |
33 n = math.floor(n/10) | |
34 end | |
35 return sum | |
36 end | |
37 | |
28 the = 1 | 38 the = 1 |
29 while (the % 7 ~= 0) do | 39 while (sumdigits(the) % 7 ~= 0) do |
30 the = (math.random(1, 999999)*10)+math.random(1,7) | 40 the = (math.random(1, 999999)*10)+math.random(1,7) |
31 end | 41 end |
32 print(string.format("%07d", the)) | 42 print(string.format("%07d", the)) |
33 }} | 43 }} |
34 |else:{code: | 44 |else:{code: |