Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
|
|
@ -12,38 +12,38 @@ if (#1 < 2) {
|
|||
IC('1') IN
|
||||
#10 = #1
|
||||
While (#10 > 1) {
|
||||
#12 = 0 // carry out
|
||||
#15 = 1 // column (ones, tens, hundreds...)
|
||||
Repeat (ALL) { // Sum all columns
|
||||
Line(-1) // n-1
|
||||
Goto_col(#15)
|
||||
if (At_EOL) { // all digits added
|
||||
break
|
||||
}
|
||||
#11 = Cur_Char - '0' + #12 // digit of (n-1) + carry
|
||||
Line(-1) // n-2
|
||||
Goto_Col(#15)
|
||||
if (!At_EOL) { // may contain fewer digits than n-1
|
||||
#11 += Cur_Char - '0'
|
||||
}
|
||||
Goto_Line(3) // sum
|
||||
EOL
|
||||
#12 = #11 / 10 // carry out
|
||||
Ins_Char((#11 % 10) + '0')
|
||||
#15++ // next column
|
||||
}
|
||||
if (#12) {
|
||||
Goto_Line(3)
|
||||
EOL
|
||||
Ins_Char(#12 + '0') // any extra digit from carry
|
||||
#12 = 0 // carry out
|
||||
#15 = 1 // column (ones, tens, hundreds...)
|
||||
Repeat (ALL) { // Sum all columns
|
||||
Line(-1) // n-1
|
||||
Goto_col(#15)
|
||||
if (At_EOL) { // all digits added
|
||||
break
|
||||
}
|
||||
#11 = Cur_Char - '0' + #12 // digit of (n-1) + carry
|
||||
Line(-1) // n-2
|
||||
Goto_Col(#15)
|
||||
if (!At_EOL) { // may contain fewer digits than n-1
|
||||
#11 += Cur_Char - '0'
|
||||
}
|
||||
Goto_Line(3) // sum
|
||||
EOL
|
||||
#12 = #11 / 10 // carry out
|
||||
Ins_Char((#11 % 10) + '0')
|
||||
#15++ // next column
|
||||
}
|
||||
if (#12) {
|
||||
Goto_Line(3)
|
||||
EOL
|
||||
Ins_Char(#12 + '0') // any extra digit from carry
|
||||
}
|
||||
BOF
|
||||
Del_Line(1) // Next n
|
||||
Line(1) EOL
|
||||
Ins_Newline
|
||||
#10--
|
||||
BOF
|
||||
Del_Line(1) // Next n
|
||||
Line(1) EOL
|
||||
Ins_Newline
|
||||
#10--
|
||||
}
|
||||
Goto_Line(2) // Results on line 2
|
||||
Goto_Line(2) // Results on line 2
|
||||
}
|
||||
// Copy the results to text register 10 in reverse order
|
||||
Reg_Empty(10)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue