× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Just guessing ...but

From Wikipedia

Balanced primes
Primes which are the average of the previous prime and the following prime.
5, 53, 157, 173, 211, 257, 263, 373, 563, 593, 607, 653, 733, 947,
977, 1103, 1123, 1187, 1223, 1367, 1511, 1747, 1753, 1907, 2287, 2417,
2677, 2903, 2963, 3307, 3313, 3637, 3733, 4013, 4409, 4457, 4597, 4657,
4691, 4993, 5107, 5113, 5303, 5387, 5393 (A006562)
First Balanced prime greater than 512 ????


So n mod 563 in (0...562)

So I'm assuming the table has just 512 entries and 563 is a good approximation to obtain a perfect hash i.e. no collitions in that range.

But I can be wrong, just my 2 cents.


--- On Sat, 3/13/10, Gene_Gaunt@xxxxxxxxxxxxxxx <Gene_Gaunt@xxxxxxxxxxxxxxx> wrote:

From: Gene_Gaunt@xxxxxxxxxxxxxxx <Gene_Gaunt@xxxxxxxxxxxxxxx>
Subject: Re: [MI400] QPROCT and QPRODT
To: "MI Programming on the AS400 / iSeries" <mi400@xxxxxxxxxxxx>
Date: Saturday, March 13, 2010, 6:48 PM

QPROCT hashes the 8-letter MI opcodes into 563 linked lists.  All those
x'FFFF's you observes in the QPROCT space are linked list tombstones.

The hash algorithm is remarkable: view the 8-letter opcode as two 4-byte
signed integers; exclusive-OR them together; divide by 563 and keep the
remainder; if the remainder is not positive, add 563.  The result is a
number in the range 1 to 563, which is your index into the hash anchor
array.  Here is MI code a disassembler can use to get your hash number:

DCL DD OPCODE CHAR(8);
DCL DD INDEX BIN(4);

XOR      INDEX, OPCODE(1:4), OPCODE(5:4);
REM(SB)  INDEX, 563 / NPOS(SKIP);
ADDN(S)  INDEX, 563;

SKIP:

And this begs the question:

Why 563?


_______________________________________________
This is the MI Programming on the AS400 / iSeries (MI400) mailing list
To post a message email: MI400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/mi400
or email: MI400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/mi400.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.