04-21-2015, 04:18 PM
Dismal arithmetic was invented to help less proficient arithmeticians to achieve easier results. There are two operations, addition & multiplication.
Addition is no-carry & the sum of two digits is the larger of the two.
eg 123456789 + 987654321 = 987656789
Multiplication is no carry & the product of two digits is the lesser of the two.
eg 12345678901 * 7 = 12345677701
The first few dismal squares are:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 100, 111, 112, 113, 114, 115, 116, 117, 118, 119, 200, 211....
For more see:
http://oeis.org/A087019
For more info & better explanations than I can give, try these three links:
https://proofwiki.org/wiki/Definition:Dismal_Addition
https://oeis.org/wiki/Dismal_arithmetic
http://arxiv.org/pdf/1107.1130.pdf
Two programmes for the HP 49G; DPLUS accomplishes dismal addition of two positive integers & DMULT the dismal multiplication of two positive integers.
DPLUS
DMULT
I eagerly await the appearance of some dismal arithmetic programmes on the Prime.
Addition is no-carry & the sum of two digits is the larger of the two.
eg 123456789 + 987654321 = 987656789
Multiplication is no carry & the product of two digits is the lesser of the two.
eg 12345678901 * 7 = 12345677701
The first few dismal squares are:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 100, 111, 112, 113, 114, 115, 116, 117, 118, 119, 200, 211....
For more see:
http://oeis.org/A087019
For more info & better explanations than I can give, try these three links:
https://proofwiki.org/wiki/Definition:Dismal_Addition
https://oeis.org/wiki/Dismal_arithmetic
http://arxiv.org/pdf/1107.1130.pdf
Two programmes for the HP 49G; DPLUS accomplishes dismal addition of two positive integers & DMULT the dismal multiplication of two positive integers.
DPLUS
Code:
::
CK2&Dispatch
# FFFF
::
NULL$
3UNROLL
FPTR2 ^Z>S
xSREV
SWAP
FPTR2 ^Z>S
xSREV
OVERLEN$
OVERLEN$
#MIN
#1+_ONE_DO
DUP
CDR$
SWAP
CAR$
ROTDUP
CDR$
3UNROLL
CAR$
2DUP#<
?SWAPDROP
4ROLLSWAP
>H$
3UNROLL
LOOP
&$
xSREV
SWAP&$
FPTR2 ^S>Z
;
;
DMULT
Code:
::
CK2&Dispatch
# FFFF
::
DUP
PTR 2F3A3
COERCE
DUP#0=csedrp
FPTR2 ^2DROPZ0
Z0_
4UNROLL
#1+_ONE_DO
Z10_
FPTR2 ^ZDIVext
3PICKSWAP
NULL$
3UNROLL
FPTR2 ^Z>S
CAR$
SWAP
FPTR2 ^Z>S
SWAP
OVERLEN$
#1+_ONE_DO
DUPROT
DUP
CAR$
SWAP
CDR$
4UNROLL
2DUP#>
?SWAPDROP
4ROLLSWAP
>T$
3UNROLL
LOOP
2DROP
FPTR2 ^S>Z
4ROLL
ID DPLUS
SWAPROT
Z10_
FPTR2 ^RMULText
SWAPLOOP
2DROP
;
;
I eagerly await the appearance of some dismal arithmetic programmes on the Prime.