Post Reply 
checkdigit calculation for HP-17b
07-26-2015, 12:56 PM
Post: #3
RE: checkdigit calculation for HP-17b
(07-26-2015 07:47 AM)Thomas Klemm Wrote:  
(07-26-2015 12:08 AM)Don Shepherd Wrote:  This reduced the size of the equation from 164 characters to 92 characters, a 44% reduction in size, and I achieved all of my goals.

We can go a little further:

CD = MOD(\(\Sigma\)(I:0:LOG(N):1:
L(A:MOD(IDIV(N:10^I):10)\(\times\)(MOD(I:2)-2))
+IDIV(G(A):10)
):10)

I moved the final negation into the expression so we have to calculate MOD 10 only once.
Instead of -9 we can use +1 when calculating MOD 10.
However I can't verify the formula at the moment.
Thus I could be completely wrong. Smile

Quote:The 17b is a great little machine and can exercise your mind in 2015 as well as it could in 1988.

Completely agree with you: I'm always happy when you bring it up.
The Luhn-algorithm was new to me. Thanks for letting us know.

Kind regards
Thomas

Thomas, thanks for this. I can't get it to compile, however. Can you check it?

Don
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: checkdigit calculation for HP-17b - Don Shepherd - 07-26-2015 12:56 PM



User(s) browsing this thread: 4 Guest(s)