Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Lookup table
- 1 dd:t 18996:t
- 2 dd:t 32285:t
- 3 dd:t 24203441:t
- 4 dd:t 1299471:t
- 5 dd:t 694023:t
- 6 dd:t 43444:t
- 7 dd:t 39325060:t
- 8 dd:t 49523414:t
- 9 dd:t 683663:t
- [ dsf ] sF
- # Found digit (sum ... char1 i buff digit)
- [
- lf 0=F
- dsl
- ] sN
- [ 39- ] sS # shift alpha to start at 10
- 0 # sum
- ?
- [
- 0dd sl sf # using regs for first and last, leave buff=0
- [
- r 48- # buff char-48
- d 9<S # buff ord (1-9 digits, 10-35 alpha)
- r36*+ 36 5 ^% # append to buffer (chop to last 5 char: 36^5)
- # Check table:
- 5 # buff i
- [
- d3R d3R # i buff buff i
- 36r^ % # i buff (buff % 36^i)
- ;t d0!=N # found number if table(buff % 36^i)
- s.
- r1- d0<I # buff i--
- ] dsIx
- s. # junk i; stack: sum ... char2 char1 buff
- z2<L
- ] dsLx
- s. # clear buff
- ll 10* lf++ # sum += 10*last + first (string reversed)
- ? z1<M
- ] dsMx
- [Part 2: ]np
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement