Thread View: aus.mathematics
6 messages
6 total messages
Started by Bruce Varley
Sat, 21 May 2011 13:17
Product and sum of integer array as test for repeats
Author: Bruce Varley
Date: Sat, 21 May 2011 13:17
Date: Sat, 21 May 2011 13:17
13 lines
2202 bytes
2202 bytes
This is an outcome of an industrial problem that's been solved with some brute force computer work, this posting is just a result of my curiosity. We had the task of checking an array of integers for duplicates, due to the hardware involved the traditional approaches weren't suitable. One of our people came up with an algo that works for the cases that we encounter in the field, I'm wondering whether the result holds for all n. There is an array of n integers between 1 and n, with no repeated members, in any order. Let P be the product of all the entries, and S be the sum. The postulate is that no other set of n integers, all between 1 and n (obviously containing repeats) will have the same values for both P and S.
Re: Product and sum of integer array as test for repeats
Author: kym
Date: Sat, 21 May 2011 14:24
Date: Sat, 21 May 2011 14:24
20 lines
1948 bytes
1948 bytes
Bruce Varley <bv@nospam.com> wrote: > This is an outcome of an industrial problem that's been solved with some > brute force computer work, this posting is just a result of my curiosity. > We had the task of checking an array of integers for duplicates, due to the > hardware involved the traditional approaches weren't suitable. One of our > people came up with an algo that works for the cases that we encounter in > the field, I'm wondering whether the result holds for all n. > There is an array of n integers between 1 and n, with no repeated members, > in any order. Let P be the product of all the entries, and S be the sum. > The postulate is that no other set of n integers, all between 1 and n > (obviously containing repeats) will have the same values for both P and S. 1 54 55 sum 110 product 2970 5 6 99 --- You whackos [i.e. "scientists"] just keep changing your "predictions" to suit reality! -- BONZO@27-32-240-172 [86 nyms and counting], 16 Feb 2011 15:57 +1100
Re: Product and sum of integer array as test for repeats
Author: Bruce Varley
Date: Sun, 22 May 2011 10:25
Date: Sun, 22 May 2011 10:25
29 lines
2776 bytes
2776 bytes
<kym@kymhorsell.com> wrote in message news:4dd7cb2e$0$24911$afc38c87@news.optusnet.com.au... > Bruce Varley <bv@nospam.com> wrote: >> This is an outcome of an industrial problem that's been solved with some >> brute force computer work, this posting is just a result of my curiosity. >> We had the task of checking an array of integers for duplicates, due to >> the >> hardware involved the traditional approaches weren't suitable. One of our >> people came up with an algo that works for the cases that we encounter in >> the field, I'm wondering whether the result holds for all n. >> There is an array of n integers between 1 and n, with no repeated >> members, >> in any order. Let P be the product of all the entries, and S be the sum. >> The postulate is that no other set of n integers, all between 1 and n >> (obviously containing repeats) will have the same values for both P and >> S. > > > 1 54 55 sum 110 product 2970 > > 5 6 99 > > --- > You whackos [i.e. "scientists"] just keep changing your "predictions" to > suit reality! > -- BONZO@27-32-240-172 [86 nyms and counting], 16 Feb 2011 15:57 +1100 Yep, the conjecture breaks for n=9 also.
Re: Product and sum of integer array as test for repeats
Author: kym
Date: Sun, 22 May 2011 10:40
Date: Sun, 22 May 2011 10:40
16 lines
1573 bytes
1573 bytes
Bruce Varley <bv@nospam.com> wrote: [...] What you may be looking for is a "perfect hashing" scheme. While Don Knuth wrote in his book such schemes might be very dificult to find, quite a few are now known. Give it a Google. There is also a UNIX/Linux/GNU tool called "gperf" that creates perfect hash tables for strings (normally used for reserved word or keyword lookup) that might either do what you want or be adapted. -- "Denialism"? Is that a word? -- Mickey Langan, Sun 2 Jan 2011 4:50 pm
Re: Product and sum of integer array as test for repeats
Author: Bruce Varley
Date: Sun, 22 May 2011 13:03
Date: Sun, 22 May 2011 13:03
25 lines
2558 bytes
2558 bytes
<kym@kymhorsell.com> wrote in message news:4dd8e833$0$22474$afc38c87@news.optusnet.com.au... > Bruce Varley <bv@nospam.com> wrote: > [...] > > What you may be looking for is a "perfect hashing" scheme. > While Don Knuth wrote in his book such schemes might be very dificult > to find, quite a few are now known. > > Give it a Google. > > There is also a UNIX/Linux/GNU tool called "gperf" that creates perfect > hash tables for strings (normally used for reserved word or keyword > lookup) > that might either do what you want or be adapted. > > -- > "Denialism"? Is that a word? > -- Mickey Langan, Sun 2 Jan 2011 4:50 pm Thanks, I'll follow that up. This function has to run on a specialised industrial platform with minimal capabilities (yes, amazingly they do still exist), classical algos such as hashing are likely to be OTT. I have a couple of workarounds up my sleeve. Cheers
Re: Product and sum of integer array as test for repeats
Author: kym
Date: Sun, 22 May 2011 13:33
Date: Sun, 22 May 2011 13:33
17 lines
1976 bytes
1976 bytes
Bruce Varley <bv@nospam.com> wrote: ... > Thanks, I'll follow that up. This function has to run on a specialised > industrial platform with minimal capabilities (yes, amazingly they do still > exist), classical algos such as hashing are likely to be OTT. I have a > couple of workarounds up my sleeve. Cheers Generalisations of Pearson hashing only require XOR and indexing into a table. --- Why have you posted binaries to a text-only newsgroup, fuck wit? Would you like to see how it appears in a compliant newsreader, which all of the usenet with IQs beyond single digits use? It appears as above in the quoted text - NO IMAGES AT ALL! ROTFL [Seems like "fuckwit" has never seen HTML before]. -- Gillard Lies <oyrooloutacarbontax@gmail.com>, 18 Feb 2011 22:57 -0800 (PST)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads