Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special "Oh So Simple !..." - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special "Oh So Simple !..." (/thread-135156.html) |
Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special "Oh So Simple !..." - Valentin Albillo - 04-01-2008 Hi all,
April 1st, 2008 Spring Special "Oh So Simple !..." for you to tame with the invaluable help of the trusty HP calc model of your choice, whether vintage or cutting-edge, plain-vanilla RPN, powerful graphical RPL, or the HP-71B.
This time the focus is on simplicity. As usual, the challenge is subdivided into five
Also, to make it even simpler for you (should that be possible), before the Challenge proper
The three-pronged pre-Challenge training: 1: Simplest
Given an arbitrary 4x4 real matrix, write a program to compute and output the sum
For instance, given the 4x4 matrix: 0.983142345 0.283197300 -4.115518475 -1.660698552your program must compute and output the value 5.798972165, because its four eigenvalues happen to be: e1 = 2.00989376355and e1 + e2 + e3 + e4 = 5.798972165 MRM (Minimum Recommended Model) = HP-10C.
I'll post my original RPN solution for both the HP-10C (3 steps) and another
2: Simpler
accurate to at least 100 decimal places. MRM: HP-42S. I'll post my original short solution for the HP-71B
3: Simple
where machine-representable means that the numerical value in question can be represented exactly MRM: HP-11C. I'll post my original 2-line solution for the HP-71B.
The Challenge:1: Simplest
same number of elements such that the respective sums of the elements, the squares of the elements, and the cubes of the elements of each set are equal.
For instance, we can form the sets [ 0,1,2,3,12,13,14,15 ] and [ 4,5,6,7,8,9,10,11 ]
MRM = HP-10C. I'll post my short, generalized RPN solution for the HP-10C as well
2: Simpler
to find five numbers when given their pairwise sums and it was stated there that for the general case of N numbers there's always a unique solution except when N is a power of 2, where multiple distinct solutions can be found. So you're asked to
Write a program to find two distinct non-negative sequences of 2N elements
MRM = HP-10C. Again, I'll post my original RPN solutions for the HP-10C and a more
3: Simple
only to Susan and their product only to Peter, both assumed to be ideally intelligent and honest students. She then asks if they can figure out what the original numbers are, and their dialogue goes as follows:
Peter: I'm sorry Ms. Germain but I can't figure out the numbers right now ... If they could, your HP can too, so: Write a program to find the two original numbers. MRM: HP-15C. I'll post my original solution for the HP-71B
4: Less Simple
if you multiply each element by it, the set is now entirely composed of perfect powers.
The set may have up to five arbitrary (but distinct) nonzero elements,
For instance, if the given set is [ 3,4 ], a possible exact solution is represented
Once written, use your program to find such a constant for these sets: - The Generations set : [ 41, 67 ] MRM: HP-41CV. I'll post my original solution for the HP-71B
5: Least Simple
when k = 2 and x1 = 3 continues with
all of which are nicely integer. Regrettably, x7 = 8747993810.2857,
Write a program which, given k and x1, both integer and > 1 , finds and outputs
For example, for the value x1 = 3 above, your program should output 7 (index of the
Once written, use your program with k = 2 and the starting values x1 = 15, 41, 42, 50, 67,
MRM: HP42S. I'll post my generalized original solution for the HP-71B
That's all. I think you'll heartedly agree with me that this time everything's really simple,
And remember: Do-Not-Cheat. No googling, no computer programs in C# or Excel, no bending of Best regards from V. Ad. 1- Simplest - Nenad (Croatia) - 04-02-2008 The result (sum of eigenvalues) is the sum of main diagonal elements of the original matrix, as I recall from Linear Algebra courses (though I do not remember why).
3 steps solution: + + +
Re: Pre-Challenges #2-3 - Steve Perkins - 04-02-2008 Pre-Challenge #2 I believe I have determined what the real roots of the equation are. I just wish I could prove mathematically that these are the only roots. Here is a program for the HP-25 to output them:
01 6 Pre-Challenge #3 I'm not so great with calculators anymore, but I can (usually) do some algebra. I noticed quickly that the X^2 terms would cancel out giving a linear equation. So I expanded the terms. I ended up concluding that the equation is satisfied for ALL real numbers. This leaves me with a puzzle. How to write a program to satisfy the letter of the problem statement. "Write a program to output all machine-representable real roots of the equation:"
Can a program be written to (theoretically) output ALL machine-representable values?
Re: Exercices 2&3 - J-F Garnier - 04-02-2008 As for the exercices 2&3, with the help of my HP-71B:
#2
SSMC20 Challenge 1. - Egan Ford - 04-02-2008 Quote:I have two solutions for this problem. The first is brute force. The 2nd solution is based on my observations of the first solution. Brute force HPGCC solution:
I started with the following identities that I obtained from one of my text books (Excursions in Number Theory, Pg 19): Sum of sequential digits: n*(n+1)/2One of the sets would have a zero, so I only had to find 7 numbers out of 15 (6435 combinations total) that when summed all 3 different ways equaled 1/2 of the above equations with n = 15.
Output from my HPGCC/50g program (source at end of this post): gotit! The first sequence of numbers all have an even number of 1s (base 2) and the second sequence all have an odd number of 1s.
My 16C program to calculate the sets: 001 - 42 34 CLEAR REGToggling line 008 from x!=0 to x=0 will determine which set. After 8 numbers just kill the program.
I find this relationship astounding, but I have not had time to explore it much today. Perhaps this weekend. I did modify my brute force program to find more sets that meet the original problem criteria and discovered a few more things of interest:
k=3
HPGCC Program: #include <hpgcc49.h> SSMC20 Challenge 2. - Egan Ford - 04-02-2008 Quote:Hmmm... Same as challenge #1:
16C: 001 - 42 34 CLEAR REGJust kill after getting 2^N digits, then change 008 to x=0 and rerun to get the other set.
Re: Ad. 1- Simplest - John Keith - 04-02-2008 On the 48GX and later, only one step: Re: Challenges #4 - Steve Perkins - 04-03-2008
>2 DESTROY ALL @ DIM A(5) @ INPUT "HOW MANY (2-5)";C This is brute force (but simple). I started with the 2 number case (call them A,B). I soon found that a multiplier of A^2 * B^3 always worked. When you multiply by A you got a perfect cube. When multiplied by B a perfect square. Extending to 3 numbers (A,B,C) I needed A^15 * B^20 * C^24 to assure even 2nd, 3rd and 5th powers. Of course this often isn't the smallest possible multiplier that satisfies, but it does seem to work. The output for the sets given is kind of boring (and not optimal):
41 ^ 1115 * 67 ^ 770
Edited: 3 Apr 2008, 11:23 a.m.
Re: Challenges #4 - Valentin Albillo - 04-03-2008 Hi, Steve: Steve posted:
For instance, for the sample set [3,4], where I stated that the single-digit constant 9 would do the work, your solution produces instead:
which certainly could use a little "optimization". For the challenge sets the situation is much, much worse. So, congratulations for giving such a short, clever solution (which I assume is fully correct, can't run right now), you've certainly done your part and fully deserve the credit, but this certainly wasn't what I had in mind. I'm not asking for the smallest possible constant (though that would be nice) but at least something not very far from it, say a few orders of magnitude at most. Got what it takes ? :-) Best regards from V.
Re: Challenges #4 - Egan Ford - 04-03-2008 The original problem states "exact representation". What does that mean exactly? Is a^x * b^y * ... allowed?
My solution (still working on it) provides the smallest constant. Some of the constants are 11 digits long. This would make the MRM of a 41CV a bit challenging. Edited: 3 Apr 2008, 12:02 p.m.
Re: Challenges #4 - Valentin Albillo - 04-03-2008 Hi, Egan: Egan asked:
Though I would recommend that if said representation can be exactly evaluated without precision loss, it should be for the user's benefit.
Best regards from V.
Re: Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special "Oh So Simple !..." - PeterP - 04-06-2008 I don’t know how I missed this over the last couple of days! Thanks for a wonderful exercise again Valentin! Anyway, I started at the end and while this is a challenge it is always an impossibility to me, so why not post some thoughts and ask for advice? (I have refrained from reading the existing posts so please forgive me if there is already a tip/solution for below. The headers make believe there is not, but who knows) Looking at the last problem, it seems that (at least for 41's) the main problem would be how to handle the very quickly very large numbers. So lets definitely start with k=2 and ignore k>2 for the time being.
One way to deal with large numbers is to store them as their prime-factorization. starting with the definition of Xn+1 we can write it also as (I think) (n+1)*Xn+1 = Xn*(Xn+n)Now we also know that we only need to calculate Xn+1 if Xn is an integer, which means it is divisible by n.
So with PXn being the product of all prime factors of Xn/n we can also write (n+1)*Xn+1 = nPXn*(PXn + n)
Okay, and here is where I am stuck (don't be surprised that it is this early, remember its me, the blundering amateur of the crowd!) I know that y and (y+1) don’t share any prime-factors but that’s about all. Any hints on how to think about this would be greatly appreciated! Assuming, that this can be solved, below is the simple outline for a program which should be possible to implement even on a 41, though we might have some storage restrictions there. The main calculation burden is on calculating the prime factorization of n (there are plenty good algorithms for this and n, most likely, will be small anyway before the sequence stops although I assume it might be large for X1 = 99…) The calculation of relatively large numbers should be possible via this factor representation. Assuming that we can factor (y+1) relatively quickly given the factorization of y we should also have manageable run-times. The biggest problem for the 41 would memory for the prime-numbers and factor loadings as we probably should start by storing say the first 100 prime-numbers or so. No problem here for the excelsior model 71b. But the sticky point is the factorization of y+1 given the factorization of y… After that the below flows more or less automatically modulo the bugs or oversights as the below obviously has not been actually tested. Just to be clear – I do not consider this at all an entry to the challenge as it is no program whatsoever. It is however a though and question and any hints in which way to think from here will be much appreciated.
1) Calculate and store the first 100 primes in an array P1/register block. So P1(1)=2, P1(2)=3, P1(3)=5,etc Tomorrow I hope to spend some time working further backwards, but I fear already for my productivity next Week... Thanks again!
Peter
Re: Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special "Oh So Simple !..." - Valentin Albillo - 04-07-2008 Hi, PeterP: PeterP wrote:
"I have refrained from reading the existing posts so please forgive me if there is already a tip/solution for below. The headers make believe there is not, but who knows"
"Looking at the last problem, it seems that (at least for 41's) the main problem would be how to handle the very quickly very large numbers."
"Okay, and here is where I am stuck [...] How can I get the
For instance, in the simplest case of x1 = 15, we find that the subsequent terms are x2 = 120, x3 = 4880, ...but by the time we reach x7 we already have: x7 = 10071474279560550942943268913985959275648738701120and the factorizations of x7, x7 + 1, and x7 - 1 are, respectively: x7 = 2 * 2 * 2 * 2 * 2 * 2 * 5 * 19 * 61 * 199 * 257 * 1871 * 562673 * 4204807 * 119949240928703736556753which, as you can see, do involve very large factors and have very, very little in common.
Thus, unless you can deal with these large values and factors, I think another approach will prove more fruitful. Thanks again and
Best regards from V.
Edited: 7 Apr 2008, 8:25 a.m.
Re: Challenge 1 - PeterP - 04-07-2008 First problem – the below is a solution to the first problem for the 41CV.
It uses two ideas. Second, it is obvious that the sum of squares and sum of cubes we are looking for in our octet is exactly halve of the sum of the squares/cubes of all integers.
The structure of the behemoth below is as follows (1) Pre-fill the registers with the sum of the squares and cubes of the pairs in a convenient fashion
Edited: 7 Apr 2008, 4:13 p.m.
Re: Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special "Oh So Simple !..." - PeterP - 04-07-2008 thanks for your kind words and hints Valentin, I'll keep working at it... Cheers
Peter
Re: Challenge 1 - Egan Ford - 04-08-2008 Quote:I have been swamped with professional and personal obligations. My goal for all 4 parts to be complete by 4/1 slipped.
My 41CX article briefly discusses HP41UC for compiling and printing. The proper HP41UC documentation is here: http://www.hpmuseum.org/software/41uc.htm. The latest version can be obtained from http://hp41.claughan.com/files/hp41uc.zip . It is a DOS program. If you are a Mac or Linux user then you can install DOSBox to run the utility. This is covered in my article. As for emulators, so far I have only documented V41 and EMU41. EMU41 is DOS-based, so if you got HP41UC working you have EMU41 working too. That is the easy part. The hard part is documenting all the different methods of getting code to and from a physical 41 for Windows, Mac, and Linux. I've already done a lot of the research, but there is still so much more to do. Perhaps I'll just skip that part.
Re: Challenge 1 - PeterP - 04-08-2008 Egan, Thanks for the kind info. I have been looking into SDK41 and I am working on converting the original txt based documentation into a nicer formatted pdf document and maybe some extra info. Also, though I am lightyears behind your level of understanding, I'd be happy to collaborate and write up/research some parts so that you might have some basis to work with rather than having to start from scratch. Just a thought, you know how to reach me :-) Cheers
Peter
Re: Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special "Oh So Simple !..." - Egan Ford - 04-08-2008 Quote:I made a lazy attempt last week before I left on vacation. Knowing that it would be impossible I still wrote an arbitrary precision version. And, yes it failed, but you already knew that. But, all was not lost. I did discover that: x1 = 3,10 index = 7 remainder = 2The 3 and 10 cases didn't need arbitrary precision, but 4,6,7,9 needed more than 17000 digits. This data provides me with multiple test cases for my analytical solution. I'll try to have something this week or next. Challenge 2 - PeterP - 04-08-2008 First, let me admit that I did read the thread for the recent Valentine’s day challenge and shamelessly used some information left there by Valentin. I hope that I can get a ‘by’ for this cheating from the kind author… I started this second challenge by looking at known solution to see if there is anything to learn from them
For n = 2 we have (posted by Valentin in the Valentine Day’s challenge) and n = 3 (from my solution for the first challenge of SSMC20) |1 2 4 7|
Two observations:
Based on the above observation I thought about creating the solution for n=4 by trial and error and while doing so I made a third observation
(u,l)for upper and lower sequence. Additionally, lets denote with a ‘1’ if the upper sequence has the higher number and with a ‘0’ if the lower sequence as the higher number. This representation yields the following string of 1s and 0s for n=2,3,4 where I have taken the liberty to delineate blocks of length n-1. |10|01|
This is a neat reversing patter where we can write an explicit formula for the 1’s and 0’s as a not() function of previous 1’s and 0’s as per below with x(i) being the value at position i i = 1 to N;
So lets just start with u(1) = 1 and l(1) = 0. This means that x(1) = 1 as the upper sequence has the higher number. Recursively using the above formula we get x(2) = not(x(1)) = 0
which in turn delivers the recipe and solutions for n = 1,2,3,4 as |1 0| => |1 2| From here it is relatively straight forward to write a program, however from a quick glance at the manual, it seems that the HP16c (which I have never used) would be most suited given his extensive capabilities with binary numbers. The below code is an implementation for the 41 and is generally very inefficient as it uses 1 reg per position so it maxes out at about n=7. If one would want to make it work for larger numbers, one could devise a space saving mechanism to store up to 31 positions in each register and use the Bit? function of the AdvModule (or somewhat more convenient functions of the CCDmodule). However, I would assume that someone familiar with the HP16c can write a much shorter and faster program… The code below creates first the sequence of 1’s and 0’s by a simple double loop flipping each bit separately before it proceeds to use the bit-pattern to create the sequence. Output is in the form of (u,l) and sequential. Keep pressing r/s for each new pair to appear. As usually there is a bunch of STO functions at the start for repeatedly used numbers as they are so sloooow on the HP41.
LBL ‘C2
Re: Challenge 1 - Egan Ford - 04-08-2008 Quote:I wouldn't say that. I've been a 41CX user for less than a year. As I discover things that are not well documented or fragmented in too many places I try to make a point of documenting it for other 41 n00bs. Kind of a cookbook, start to end. Quote:Thanks, that'd be great. I'll send you a draft in a few weeks for your review. Problem #5 - Eamonn - 04-09-2008 Hi Valentin, Thanks once again for yet another great S&SMC. I don't know where you come up with the challenges, but it can't be easy to make them so that they have just the right amount of difficulty that a pocket calculator is a good tool to help solve them. Anyway, I see that there have not been a lot of responses to the more difficult challenges so far. This is most likely due to the difficulty level and not due to a lack of trying on the behalf of the MoHPC audience. At least it gives slowpokes like me a chance to work on a solution before one is posted. I believe that I have a solution to problem 5. It seems to work on paper, but I haven't had time yet to write a calculator program that automates it. I plan to do this in the next 24 to 48 hours and post it when I do so. I'm hoping that you will postpone posting your solution until I (and others that I am sure are working on this problem) get a chance to finalize and post my solution. The basic idea is to calculate x(n) mod b and use that to calculate x(n+1) mod b. If x(b) mod b is not 0 then the solution is that the index is b and the remainder is x(b) mod b. Working with x(n) mod b keeps the figures very manageable. The problem was really how to calculate x(n+1) mod b from x(n) mod b, which is easier to state than to do. Once I figured out how to do that, the rest was straightforward. As I said, I have only tried this on paper, but it seems to work so far. Best regards,
Eamonn
SSMC20 Challenge 5. (answers w/ question) - Egan Ford - 04-09-2008 Valentin,
can you confirm if the following is correct: x1: 3 k: 2 index: 7 fractional part: 0.285714285714Thanks. Re: Problem #5 - Egan Ford - 04-09-2008 Quote:If you are trying to solve ax = b mod m, just set x = 1, and increment x until ax mod m = b. Re: SSMC20 Challenge 5. (answers w/ question) - Valentin Albillo - 04-09-2008 Hi, Egan:
Egan posted:
x1: 3 k: 2 index: 7 OK It's strange that your results differ from mine in two cases about the middle of the table. I've tried my algorithm in two different implementations, one written in HP-71B's BASIC, the other written in a math software package's language, and both absolutely agree for the 200+ cases I've tried, which include values of x1 from 2 to 15 plus 41, 42, 50, 67, 71, 1958, 1992, 2008 and assorted others, and for values of k ranging from 2 to 10.
This doesn't preclude the possibility of an error on my part, of course, so please check your own implementation for the cases in disagreement (50 and 67) and if you find nothing wrong with your code e-mail me at the address given in my calc web page (don't forget to include "HP CALCS" somewhere) and we can probably sort it out. Also, if you need more test results for other values of x1 or other values of k, let me know and I'll provide them to you ASAP. Thanks for your interest and
Best regards from V.
Re: Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special "Oh So Simple !..." - Valentin Albillo - 04-09-2008 Hi, Egan: Egan posted:
version. And, yes it failed, but you already knew that."
subchallenge #4 are the kind of teasers explicitly concocted to offer some resistance to people with your considerable abilities, all easier tasks having been met quite successfully by you in the past. And yes, I knew.
"But, all was not lost. I did discover that [...] The 3 and 10 cases didn't need
Remember that the last one is for k=3, not k=2 like all the rest, so your program should ideally cope with general integer k > 1 as well.
"This data provides me with multiple test cases for my
post my original solutions to next Monday so that enough time is available for you to try and solve them.
Anyway, I must say that it's a pity that this S&SMC#20 has apparently failed to arouse
I was under the impression that, since a full year has elapsed since the previous S&SMC#19, challenge-loving, math-loving people
Regrettably it seems that either I missed the mark with the difficulty or else people are I take this as a strong signal that my S&SMC's have overstayed their welcome and have now been relegated to the status of minimally interesting topic only appreciated by a very tiny minority (perhaps less than a handful people) while the vast majority of forum regulars and visitors aren't that interested anymore, if at all.
Since these challenges do take a lot of time and effort to concoct (research suitable topics, long-list and short-list the most awesome and better suited, create original solutions for them,
After all, 20 is a nice round number so we can adequately
Best regards from V.
Re: Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special "Oh So Simple !..." - Maximilian Hohmann - 04-09-2008 Hello! Although it was not addressed at me, I MUST answer this one:
Quote: No, no, no! 20 is not a nice round number. I am far too dumb to come up with a solution for even the "simplest" of your challenges (seriously considering of having my academic grade erased from my passport now :-( ) but as long as you keep coming up with new ones there is always hope! I would suggest 314 as a nice round number for the final challenge :-) Greetings, Max (looking forward to your solutions - even got myself a MATH ROM for my 71B since the last challenge, so that I can, at least, type them into the calculator myself) Re: Problem #5 - Valentin Albillo - 04-09-2008 Hi, Eamonn:
Eamonn posted: "Thanks once again for yet another great S&SMC. I don't know where you come up with the challenges, but it can't be easy to make them so that they have just the right amount of difficulty that a pocket calculator is a good tool to help solve them."
"Anyway, I see that there have not been a lot of responses to the more difficult challenges so far. This is most likely due to the difficulty level and not due to a lack of trying on the behalf of the MoHPC audience."
Perhaps they prefer to lurk and just see the efforts of others or even just browse through my final solutions and comments, without bothering to work them out for themselves or even post some comments of their own. I can't be sure this is the case, but I think it is a pretty educated guess. Happens the same with fan publications: people subscribe and then expect to receive a magazine choke-full with interesting information ... created by others; they aren't interested in making the effort to create and submit something interesting themselves, they simply lurk and leech. It is less tiring. Then they're surprised and upset when said publication hits the deck for lack of contributions.
"At least it gives slowpokes like me a chance to work on a solution before one is posted [...] I plan to do this in the next 24 to 48 hours and post it when I do so. I'm hoping that you will postpone posting your solution until I (and others
Again, thanks for your efforts, for your appreciation, and for taking the trouble to post so that I would know.
Re: Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special "Oh So Simple !..." - J-F Garnier - 04-09-2008 Hi Valentin,
You wrote: I can only speak for myself, but I always had an high interest in your S&SMC. But maybe this time my math skills are not good enough to solve your last "Oh So Simple !..." challenges. I found the problems #3 and #4 quite interesting for me and thought a lot about them, but was unable to devise a suitable program to solve them. I found some particular solutions "by hand" for #4, but nothing general. However, as you allow us a few days more, I may spend some more time on it. Thanks for your efforts in preparing these S&SMC and best regards,
J-F
Re: Problem #5 - Eamonn - 04-09-2008 Thanks Egan. That's basically what I ended up doing, except I started with x=0. It should give the same results I believe. Best Regards,
Eamonn
Re: Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special "Oh So Simple !..." - Egan Ford - 04-09-2008 Valentin, I think it is a combination of many factors. Most are probably just busy. And, I think that this set of problems while fascinating is also difficult to get started. I believe that your most successful challenges are simple to understand immediately. And while there is always something hidden and most fascinating in the details, the problems are simple enough for many to submit an initial good guess on a lunch break. This starts the ball rolling. And keeps the problem in their minds for follow up. Some of my favorites have been HP-15C Bits o' Pi, Vday 07 (last non-zero digit of n!), and palindromic square (42S). I would consider relaxing the restriction on Google. Research is a real world exercise. I find discovery through the work of others just as rewarding as self-discovery. Research is essential to save time. This may solve the "busy" factor and allow others a way to get started. Its not like Google is going to write the program for you. There is nothing worse than giving up in frustration because there is no avenue to aid. With the exception of SSMC19 I do not think you have ever restricted Google. I'll admit for SSMC19 A+ I did Google (although I didn't have to, someone else also did and sent me a paper to read). But, if I had not had read that paper, I would have never in a lifetime figured out how to write a program for A+. It was a difficult paper to understand and convert to code. During the process I got to correspond with the author of the paper, got copies of his research, and learned a bit of German since I had to translate much of the research myself. Quiet rewarding and I would have missed out on all of this if I and others had not Googled. BTW, it still took me 40 hours to understand this paper and write the program. I would not give up. Perhaps a series of mini-challenges is in order. I'll assume it is less work for you and probably much less work for others. If mini-challenges do not draw in the crowds, then perhaps your right and it is the end of an era. I could be completely off-base here. Perhaps if your next challenge had the words "eBay" or "fantasy calculator" in it, then more would be interested. Thank you for your efforts. I mostly visit for the challenges, it would be sad to see them go. P.S. here is a "challenge" for you:
Write a program to find non-zero integers a, b, c, and d: a4 + b4 + c4 + d4 = (a + b + c + d)4The spoiler is in AMM March 2008. I have not had the time to finish my program, but you should have no problem writing this in your sleep. Edited: 9 Apr 2008, 3:34 p.m.
Re: Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special "Oh So Simple !..." - Valentin Albillo - 04-09-2008 Hi, Egan:
The fact that certain 12-digit number is the only palindromic square, say, it's a nice curiosity but nothing else. It goes nowhere and teaches you nothing mathematically speaking, though it can be a good programming exercise. On the other hand, the fact that some apparently integer sequence fails to produce an integer after 600 terms have been generated is not only fascinating but discovering why can teach you a lot about divisibility, congruences, and working in modular arithmetic to avoid having to deal with numbers so large that no computer would ever be able to even store them, let alone perform operations on them. Nevertheless you're probably right. The former kind of challenge attracts a larger number of people than the latter, despite its irrelevancy so I might heed your advice and stick to simple mini-challenges for the HP-15C and such for now.
As for your 'challenge', I've read the same AMM issue as you did and know as much about the problem as you do, including that one possible solution is A = -2634, B = 955, C = 1770, and D = 5400, as can easily be checked: > A^4+B^4+C^4+D^4 , (A+B+C+D)^4Writing an elliptic-curve-based program to find some of the infinite solutions is hardly appealing to me right now. I'd rather use the elliptic curve approach to try and write a good factoring program instead.
Thanks and best regards from V.
Re: SSMC20 Challenge 5. (answers w/ question) - Eamonn - 04-09-2008 Hi Valentin, Egan, I have implemented my solution on a PC with Python and I get the same results as Egan for all the test cases
x1 = 3, k = 2, n = 7, Fractional Part = 2/7 One of the things I noticed is that I needed to be careful where I applied the modulo operation. To recap, I am trying to determine if x(b) is divisible by b. I find x(n) mod b for all n < b. I use x(n) mod b to calculate x(n+1) mod b, all the way to x(b) mod b. My first effort applied the modulo operator after calculating n*x(n) + x(n)^k. This gives (((n+1) * x(n+1)) mod b). I then used this to calculate (x(n+1) mod b) by adding multiples of b to (((n+1) * x(n+1)) mod b) until it was divisible by (n+1). I divided this by n+1 and took the result modulo b. However, in some cases, this leads to ambiguities. For example in the case of x(1)=67 and k=3, when testing x(54) for divisibility by 54, I start off by calculating x(2) mod 54, x(3) mod 54, etc. Using the above approach, I get:
(2 * x(2)) mod 54 = (67 + 67*67) mod 54
On to x(3) (3 * x(3)) mod 54 = (20 + 10*10) mod 54So far so good. Now, what is x(3) mod 54? It can actually be one of three values: 4, 22 or 40. My algorithm would find the first answer, 4 and use that in subsequent calculations. However, if I multiply everything out, I find that x(3) = 1,731,280, and x(3) mod 54 is actually 40.
I got around this by calculating (n+1) * x(n+1) from the previous values for (( n * x(n) )mod b) and (x(n) mod b) and using this to calculate x(n+1) mod 54 using the same approach as above. For x(3), the calculation is: 3 * x(3) = 120 In this case, it correctly calculates x(n+1) mod 54 as 40. Problem is, I don't know if the new approach gives the actual value for x(n+1) mod b in all cases. It gives a value that satisfies the equation, but in some cases, there may be multiple such values and I am not sure that this is the correct answer in all cases. If anyone is interested, let me know and I can post the python code. (Any calculators out there that can run python?) Best Regards,
Eamonn.
Re: SSMC20 Challenge 5. (answers w/ question) - Egan Ford - 04-10-2008 Quote:This is a great case of two wrongs don't make it right. I think we are using the same methods and getting the same wrong answers for 2 of the cases. Quote:I used Perl. But will convert to 71B or 42S when satisfied with my solution. BTW, if you like Python and math you may want to check out Sage. I have a Sage server at home, but there are free ones online (https://www.sagenb.org/). Challenge 3 - PeterP - 04-10-2008 Hmm, I think I am starting to see why you love the 71b. After I was able to wrap my head around the problem, it was relatively straight forward to come up with a basic type code but implementing this in RPN proved cumbersome. So, yet again, we have a very looong code. However, I do admit that I have not spent any time on improving the actual coding as I think I spent too much time in thinking on how to cut down execution time. Again, something one would need not worry too much with the 71 or 42. Alas, I am still not very apt in using the 71 (and have never used the 42 actually although I was lucky and procured a pristine exemplar a year back or so).
Ok, here is my approach, slow and long-winded as it is:
S={11,17,23,27,29,35,37,41,47,51,53,57,59,65,67,71,77,79,83,87,89,93,95,97}
LBL 'MSL
From here we proceed somewhat with brute force yet try to cut off unnecessary tests and loops (this is what proved really hard to implement on the 41. Maybe if I have time I try to write a solution for the 71 which should be much shorter...)
Now we need the remaining statements from Peter and Susan. Peter claims in his next statement that he now knows the numbers. This means that there is a value pt that only appears once. But which one? there are still many values pt that appear only once. Luckily, after his statement, Susan now also claims that she knows the numbers. This means that pt is unique and is the only unique pt for that si.
The following code implements just that, using a few short-cuts, namely
As it turns out, there is indeed only one solution which my trusty HP41 spits out after about 50sec or so. It then continues to rattle along for another 18 minutes or so to finally declare that this is the only solution. Horray. Ah yes, I believe the solution to be (4,13). And for those who really want to see it, here is the full code. Typing it in here I realized that I really need to clean this up. This is ugly...
LBL FIND
Edited: 10 Apr 2008, 3:43 a.m.
Re: Challenge 3 - J-F Garnier - 04-10-2008 Hi Peter, I'm still working on my program (not yet running), but I think your result is correct.
Let's try to verify how Susan and Peter were thinking: P=52, so Peter can't determine if the numbers are (2,26) or (4,13).The numbers are 4 and 13, if I'm correct. Valentin, can you confirm if this is correct?
Edited: 10 Apr 2008, 7:23 a.m.
Re: Challenge 3 - Valentin Albillo - 04-10-2008 Hi, J-F: Jean-François posted:
Congratulations both to PeterP for his insight and clever RPN program and to you for your accurate logic and detailed explanation. See to it that an HP-71B program is created to find the solution, nothing less is to be expected from Emu71's creator. :-)
Re: SSMC20 Challenge 5. (answers w/ question) - Valentin Albillo - 04-10-2008 Hi, Egan:
X1 K=2 K=3 K=4 K=6 K=8 K=10 Keep in mind that I can't be 100% sure these are fully correct as my algorithm and/or implementations might be buggy and this is original research, never-before-seen results as far as I know, so there's no published results that I'm aware to refer to.
However, though not 100%, I'm reasonably sure of their correctness as my algorithm is simple enough (for the HP-71B implementation it's a mere 5-line looping construction involving just 6 arithmetic operations inside), and I've implemented it in two very different languages and architectures, with both implementations fully agreeing in each and everyone of the 200+ assorted cases tested, which gives me a fair confidence that there's no great chance of there being an error. But it can happen, caveat emptor. Best regards from V.
Edited: 10 Apr 2008, 8:15 a.m.
Re: SSMC20 Challenge 5. (answers w/ question) - Egan Ford - 04-10-2008 Thanks.
My output (differences in bold): x1 k=2 k=3 k=4 k=6 k=8 k=10 I'm 100% sure its on my end. I confirmed with arbitrary precision code that x1=2008, k=6 is not 3. For 50,2 and 67,2 if you could tell me what modulo you used? Is it 17^2 and 2*17^2 respectively? That may help me find my bug.
Thanks. Edited: 10 Apr 2008, 11:08 a.m.
Re: SSMC20 Challenge 5. (answers w/ question) - Valentin Albillo - 04-10-2008 Hi again, Egan: Egan posted:
which is also integer. X4 = 124478...4462326 is integer as well, so 3 can't possibly be the correct index of the first non-integer element. Same with indexes 5 and 7 in your results, which can also be checked directly (if laboriously).
Good luck finding the (possibly very subtle) error, and Re: SSMC20 Challenge 5. (answers w/ question) - Valentin Albillo - 04-10-2008 Hi, Egan:
As for the question, I'm afraid I can't help. It seems my algorithm and yours are sufficiently dissimilar that your question doesn't apply to mine. I do several modular operations with different modulus in a single loop iteration, and it doesn't seem easy to discuss the details without disclosing the whole algorithm as it is implemented with so few basic arithmetic operations (just 6 per cycle).
Re: Challenge 3 - PeterP - 04-10-2008 wow, this is a brilliantly clear explanation, J-F. I wish I had had you as a teacher J-F, I'm very impressed. Attention, potential spoiler - having finished the challenge I did allow myself to google for Mrs Germain and found this link to learn that she is actually quite famous and has a very moving and impressive live. And her first name is Sophie... Cheers
Peter
Re: SSMC20 Challenge 5. (answers w/ question) - Eamonn - 04-10-2008 Egan, Valentin, Here is the output of my algorithm for the test cases above:
x1 k= 2 k= 3 k= 4 k= 6 k= 8 k=10 The -1 in the result for x1=1958, k=8 is because in one of the loops, my algorithm doesn't find a solution to xn mod b when given n*xn mod b. So it would appear that my algorithm still needs some refinement. Of course the results I get don't fully match either of your sets of results. Here are the cases in which the three algorithms yield different results:
x1 k Valentin Egan Eamonn We all get the same results for all the other cases. Based on the previous messages, I was thinking my algorithm would match Egans results in all cases - but sometimes it agrees with Valentins results. Clearly we are all doing something slightly different. I'll see if I can figure out why my routine fails in the (1958,8) case. Best Regards,
Eamonn.
Re: SSMC20 Challenge 5. (answers w/ question) - Eamonn - 04-10-2008 Hi Egan, Thanks for the tip about Sage - I have not come across it before. I will investigate some more. For my day job, I do quite a bit of numerical processing with Python, using Numpy and Scipy to simulate wireless communications systems. I used to use Matlab, which is great for scripting small stuff, but it's not an ideal language for large projects. I have never used Perl. When I was looking around for a good general purpose scripting language, Python won out with its clean syntax and libraries for numerical computations. They both appear to be equally capable though. Best Regards,
Eamonn.
Re: Challenge 3 - J-F Garnier - 04-10-2008 Below is my program for the HP-71B. I used an idea from Peter, i.e. a even number is always the sum of 2 prime numbers, this avoids to explicitly test for prime numbers. I found the same solution than Peter: (4,13) but the surprise is that my program finds three other possible solutions. I checked the (13,16) pair by hand in a similar way than I checked the (4,13) pair above, and it seems OK. Can somebody confirm it with another method, or did I something wrong? J-F
10 ! --- S&SMC 20 ---
Edited: 10 Apr 2008, 3:35 p.m.
Re: Challenges #4 - Steve Perkins - 04-10-2008 I haven't made as much headway as I hoped to on this problem. But it's not too hard to do better than I did.
10 DESTROY ALL @ DIM A(5) @ DIM P(5) @ INPUT "HOW MANY (2-5)";CAgain, not optimal. Probably not close enough in many cases. But maybe it gives some insight to the problem. I can see that getting the prime factorization of the numbers and looking for existing squares, cubes, or higher powers of primes can lead to optimization of the ultimate product. Also having factors in common can help. I can even see how to do it in the case of 2 numbers input. So far, more than 2 numbers have proven to be a challenging problem for me. I'll keep thinking about it.
Thanks for the enjoyable mental (and calculator) workouts, by the way. I have been looking forward to your challenges and have not been disappointed. I just wish I had the time (and brains) to give these the attention they deserve!
Re: Challenge 3 - Valentin Albillo - 04-10-2008 Hi, J-F: Jean-François wrote:
The pair (13,16) has sum 29. With that sum the first three dialogs would be fulfilled but not the fourth, i.e, Peter, given the product of 13*16 = 208 would be able to deduce the correct pair after Susan's first comment. But the fourth dialog cannot be fulfilled: Susan has no way to know if the correct sum, 29, came as 2+27 or 13+16. Think about it.
Re: Exercices 2&3 - Steve Perkins - 04-10-2008 I like your solutions to these! My question is, can we know that there are no more than 7 real roots to the equation given?
In the general case, it seems we can't even know that all real roots are integers, as I originally assumed. Consider this simpler example: 2^x + 32^x = 8^x + 18^xHow many real roots are there? What are they?
I have resisted searching the internet looking for the mathematical basis behind these types of equations. It does have me thinking, and that can't be a bad thing. :-)
Re: Challenge 3 - corrected - J-F Garnier - 04-11-2008 OK, I see my mistake, my assumption "no odd number is the sum of 2 prime numbers" is obviously false... Here is my corrected program, a bit less simple as I had to explicitly test for some prime numbers. J-F
10 ! --- S&SMC 20 ---
Edited: 12 Apr 2008, 10:43 a.m.
Re: SSMC20 Challenge 5. (answers w/ question) - Egan Ford - 04-11-2008 Quote:Please do. Re: SSMC20 Challenge 5. (answers w/ question) - Eamonn - 04-11-2008 Hi Egan, Here it is. The function findit takes x1 and k as the input parameters and returns the index and the remainder. I have not had time to figure out why it fails for the (1958,8) test case since my last post. If you wouldn't mind posting your perl code for comparison that would be great. A couple of tips for anyone trying to follow the code that hasn't seen python before: - Python doesn't use { and } as in c to group lines of code into a block. Instead, it treats lines of code at the same indentation as a single block of code. - % is the python modulo operator (eg. 17 % 5 = 2) - ** is the python power operator (eg. 2 ** 5 = 32) - # is the python comment indicator Best Regards, Eamonn
def findit(x1, k):
Edited to fix small cut/paste error in original posted code Edited: 12 Apr 2008, 12:38 a.m.
Challenge 4 - PeterP - 04-12-2008 I approached the 4th challenge first with paper and pencil. Soon I was back to prime-factorizations and developed a matrix representation scheme that proved quite useful.
so for example for the set (50,1958,2008) we would have P = (2,5,11,89,251)as 50 = 21*52*110*890*2510 Next I decided to respresent the constant we are asked to find C(n1,n2,...,nNMax) in its prime factorization form using the elements of P. This means we have to find a seperate ci for each row of PFM. Sounds like it has gotten worse, now we are looking for np constants... To generate perfect powers, there needs to be a value ppi for each number ni for which kji MOD ppi = 0 for all j=1,2,...,np The following algorithm does most likely not find the smallest constat C = product(p1c1,p2c2,...,pnpcnp) as I have arbitrarily assigned pp1 = 2,pp2 = 3,pp3 = 5, etc. I believe this to be not a horrible choice but I'm sure one can find smaller C in certain cases. Basically, depending on the relationship between the kji there is an optimal set of ppi but I could not figure out an easy way to find that set.
From here we can build a relatively fast and straight forward code which, however, I implemented in the 71b (learning a lesson from the last challenge).
Two comments to the code below. First, I am very inexperienced with using the 71b so please forgive the cluncky code. Second, I used the math-rom and the JPC rom which made the code easier to write, hoping that the kind author of the challenge will overlook this.
The code produces the following answers C(41,67) = 413 * 672
Listing (mod typos) 10 Option Base 1 @ Destroy All
Edited: 16 Apr 2008, 10:22 a.m. after one or more responses were posted
Re: Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special "Oh So Simple !..." - PeterP - 04-12-2008 Dear Valentin, for what its worth let me say that your post deeply saddened me. I personally was very much looking forward to this challenge, having missed due to workload the valentine's day challenge. Rest assured that I follow each and every challenge posted here with great interest and follow links posted and solutions shown. I have learned a great deal over the last few years through the excellent quality of the challenges that you post and the immense ingenuity of those who participate and solve them. I would believe that there is a nice crowd of silent followers who greatly enjoy your challenges and the thread of responses. At the same token, let me tell you from the perspective of a complete amateur that it takes a certain amount of guts to openly participate given the high level caliber of your challenges and the usual contributers (Egan, Eammon, J-F, Karl, Max, etc). It is always a very humbling experience for me to toil for days over individual problems and then see beautiful and simple solutions posted by others within mere minutes or a few hours after you posted the challenge! Yet for me this is an enormously enriching experience and - quite frankly - almost the only time I program these calculators. It gives me a reason to think, try and learn and find out more about these wonderful calculators. Lastly I'd like to point out the obvious - it is very hard for you 'see'/gauge all the busy work and engagement that is going on behind the scenes before people post. From your perspective it must be hard to tell if a challenge is ignored or feverishly worked upon. Personally, I have looked into and exercised 'recreational math' with almost all problems but not always found a solution within the time or the time to find a solution. While I can most definitely appreciate that time is a precious resource for you, FWIW, let me throw my vote in the hat for keeping your challenges a regular part of this forum. I would be deeply saddened to see them go. Cheers
Peter
Re: SSMC20 Challenge 5. (answers w/ question) - Eamonn - 04-14-2008 Egan, Valentin, My intention was to port the above algorithm or a slightly modified version to the HP-71B. After examining some more cases however, it is clear that the problem of multiple solutions to xn mod a, when (n * xn) mod a is known, is the root of the problem with this approach. I made an attempt at trying to decide between the possible solutions by making use of the previously calculated and stored solution to xn mod (a-1). However there are cases where this approach also fails to find a unique solution for xn mod a. This is certainly an interesting problem to work on. I now know a lot more about modular arithmetic that before, having now come across the linear congruence theorem, the extended Euclidean algorithm and the Chinese remainder theorem. Still not quite there yet with a solution. From your previous posts Valentin, it appears that you are using perhaps a different approach. I look forward to when you publish your solution, or to Egan's or anyone else's solution also. Best regards,
Eamonn.
Re: Challenge 4 - J-F Garnier - 04-14-2008 Hi Peter, I can't make your program running, probably some typos...
J-F
Re: Challenge 4 - PeterP - 04-14-2008 J-F, Thanks, yes there was a typo in line 100 (* instead of @). It should work now but I can't check (in the office and don't have the calc with me or your simulator...) Thanks for letting me know!! Cheers
Peter
Re: Challenge 4 - Steve Perkins - 04-14-2008 Is there an "easy" or at least straight-forward way to cut and paste code like this into the simulator? I'd like to try it myself, but don't have time to retype it just now.
Thanks for the wonderful EMU71 by the way, and any help you (or others) can give!
Re: Challenge 4 - Valentin Albillo - 04-14-2008 Hi, Steve: Steve posted: "Is there an "easy" or at least straight-forward way to cut and paste code like this into the simulator?"
Also, there's some controversy on whether to call this kind software "emulator" or "simulator". My own criterium is to call it "emulator" when it's actually using the original ROM assembler code which gets executed by an emulated CPU (Saturn for the HP-71B), and "simulator" otherwise (i.e., doesn't use the original ROMs nor does it execute original assembler code).
Using this criterium, Emu71 is an "emulator" for me, not a "simulator". And a pretty good one at that. Best regards from V.
Re: Challenge 4 - Steve Perkins - 04-14-2008 You're right, of course. I should have used the term "emulator" for the excellent EMU71. As for the copying and pasting, I should have explained my problem. I assumed the same thing afflicted everyone. When I try to paste a copied line, most of the text gets missed. Only a few characters get entered. It seems the emulator is looking for keystrokes and missing some when the come to quickly for the original ROM code to copy with perhaps? This is in a Windows XP cmd.exe window. Does anyone else have this problem? Or does it work better in another environment?
For instance, trying to paste (from the above code) line 240, instead of 240 Disp "1. Done!" @ Beep Re: SSMC20 Challenge 5. (answers w/ question) - PeterP - 04-14-2008 Eamonn, Sorry to bug you, but would you possibly be so kind and post (or email) me the key pieces you found to learn about the items you mentioned about modular arithmetic? I never learned it in school yet found it very interesting. Thanks for your and Egan's ongoing posting on this problem, I'm a silent follower... Cheers
Peter
Re: Challenge 4 - Valentin Albillo - 04-15-2008 Hi again, Steve:
Also, it reverts the capitalization of pasted text so that uppercase letters are pasted as lowercase and vice versa. This is transparent as far as keywords are concerned, because program listings are always generated with capitalized keywords regardless of how they were entered, but text strings will indeed change capitalization and may need manual correction. This was the case in the latest version I have, perhaps the newest one has this point straightened out. I suggest you visit J-F's Emu71 site and download the latest version. It should correct your problem at once. The exception has to do with control characters: some sequences involving the exponentiation operator ("^") get interpreted as control characters instead and have the operator missing. But this is rare enough and easily detected and corrected, if it's still a problem with the newest version.
Edited to correct a minor typo and further explain about capitalization reversal
Edited: 15 Apr 2008, 7:26 a.m.
Re: Challenge 4 - J-F Garnier - 04-15-2008 Hi Steve, Valentin explained all (Thanks, Valentin!) Please have a look here and let me know if you still have problems.
J-F
Last chance (Re: Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special) - Valentin Albillo - 04-15-2008 Hi, all:
It depends of my workload and free time availability but I'd say you still have some 24 to 72 hours before the deadline. As requested, I've extended it past the one-week usual length to allow Egan, Eamonn, and all others to refine or correct their solutions, but it seems all's said and done by now.
Thanks to all for your interest and willingness to share and
Best regards from V.
Re: Challenge 4 - Steve Perkins - 04-15-2008 Thanks, I'll install the latest right away. I feel silly that this wasn't an obvious thing for me to try.
Update: works as advertised! Thanks for the advice, and especially for the fantastic software!
Re: Challenge 4 - Steve Perkins - 04-15-2008 Nicely done Peter!
I did have to make a correction to line 220. It seemed you meant to display entries from the P() array. And a small improvement: 220 If T>0 Then Disp P(L);"^";T;" * " Other than that, I double checked most of the outputs and it ran as you specified. I'm getting more fond of the math and JPC roms too! I wish I had some good documentation for the math rom, since I finally got one with an HP-71B I acquired.
Very nicely analyzed and programmed. Edited: 15 Apr 2008, 2:55 p.m.
Re: Challenge 4 - PeterP - 04-15-2008 Steve, thanks for your kind words, improvement and identification of Typo! I was too elated & spent at that point to improve :-) As for the math rom documentation, you can find it on the fantastic DVD that Dave hicks sells here on the museum (aside from all sorts of other goodies). Check out this link And for the JPC rom, J-F has put together a great resource including manuals. Check out this link Cheers
Peter
Re: Last chance (Re: Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special) - Egan Ford - 04-15-2008 Hola Valentin,
Sadly, I've been swamped with work and travel for the last 5 days with no outlook of enough downtime to revisit #5 or #4. (Not far from you actually, in Sevilla now.) That said I have not given up, but fear I will run out of time.
Re: SSMC20 Challenge 5. (answers w/ question) - Eamonn - 04-15-2008 Hi Peter, No problem - I found most of the information searching for "modulo arithmetic". The most straightforward explanations that I found are on Wikipedia at the links below. I hope you find them useful. By the way, I was reading through your solution to Problem #4. I see that you have some modular arithmetic in there, so you seem to know a thing or two about it :-) I'll have to study your solution a bit more to fully understand it, but it looks pretty impressive. Best Regards, Eamonn Re: SSMC20 Challenge 5. (answers w/ question) - Egan Ford - 04-19-2008 Getting closer:
Expected: X1 K=2 K=3 K=4 K=6 K=8 K=10
Obtained: x1 k=2 k=3 k=4 k=6 k=8 k=10I found some time early this AM (jet lagged) to look at this again. Although my Perl code and Eamonn's Python code follow the same principal, Python has the benefit of arbitrary precision integers, whereas my Perl prototype does not. This explains most of the discrepancies in the lower right corner of my previous post. The differences are now limited to those solutions with composite index numbers.
Edited: 19 Apr 2008, 8:53 a.m.
Short & Sweet Math Challenges - Karl Schneider - 04-20-2008 Quote: Valentin -- I certainly can appreciate the time and effort you put into developing and preparing these challenges. It seems to dwarf even the substantial investments I've put into some of my own contributions (e.g., the analysis of your 7x7 "Albillo Matrix #7" and Rodger Rosenbaum's counter-example). I'll admit, however, that I haven't seriously tackled very many of your challenges, because I don't find them particularly easy or simple. I don't really have the "knack" for the kind of programming required, or the particular math knowledge (e.g., number theory), to make these challenges a straightforward exercise. I'm continually astounded, though, how certain people have always been able to post working solutions so quickly after you post the challenge -- oftentimes before I've even had a chance to see it. And yes, time is certainly the issue for me and others. There are many things that need to be done, but which would not get done if I/we invested free time in recreational solving of math problems. If such a challenge is difficult, I for one might not have enough mental effort to give to it, after the workday is over. My contributions in the MoHPC Forum tend to address known practical issues of HP calculators: identify the specific problem, and provide a concise assessment of its root cause. A few recent examples: HP-35s slowness with integration HP-15C bug: CHS and Stack Lift with zero HP-33s/35s trigonometric bug tabulated As you can see, it's kind of "inside-the-box, A-B-C" thinking. It's reasonably gratifying to find the definite and indisputable answer to a given problem without entering an ongoing process and giving extensive effort. (If only the day job were like that!) :-)
No one should complain if you decided to "call it day" regarding your S&SMC's. 20 of these is a very impressive body of work in itself (along with your may other contributions). A short article containing links to your issuance and solutions to each challenge in the Forum Archives would be a welcome addition to the Articles Forum. In fact, someone a while ago had undertaken a similar task to provide a list of challenges to date. Best regards, Karl S.
Edited: 21 Apr 2008, 3:10 a.m.
My Original Solutions and Comments - Part 1 (Re: S&SMC#20) - Valentin Albillo - 04-21-2008
Hi, all:
I've been marking time to allow Egan Ford an other kind contributors to complete their solutions to the most difficult problems but at long last, these are my original solutions and assorted comments:
The three-pronged pre-Challenge training: 1 - Simplest
01 +where you must input the four elements from the main diagonal (all other elements are irrelevant) into the RPN stack, then run the program (or press [+] three times if your calculator is non-programmable). Nenad's solution is of course the very same, and John Keith's RPL one is even shorter at essentially just one statement, TRACE. Of course, the 'fun factor' in this case was to realize that the apparently very complicated task being demanded, with seemed to require inputting a whole 16-element matrix, computing its four real/complex eigenvalues, and adding them up, was solved by simply computing the trace, which can be done by simply adding up the elements in the main diagonal. I specified that it should work for 4x4 matrices because the RPN stack is 4-level high and so the program would be as simple as possible, but the same approach would work for general NxN matrices, even complex-valued ones.
2 - Simpler
"Write a program to compute and output in one go all real roots of:
My original solution for the HP-71B is as follows: which makes use of the observation that for sufficiently large negative X there can't be any more real roots because of the predominance of some terms for those arguments, and the same goes for sufficiently large positive arguments, where other terms tend to predominate. My solution above checks the reasonable range and outputs all seven roots. You can check them from the command line like this: >FOR X=-1 TO 7 @ DISP X;FNF(X) @ NEXT XAdmittedly, this doesn't guarantee that there are no additional real roots apart from those seven but once computed that can be easily ascertained by looking at the graph or, ultimately, finding maxima and minima, etc, but that would defeat the 'fun' factor, which simply was the unexpected small integer roots in arithmetic progression, thus computable to 100-digit or whatever accuracy with no effort whatsoever. What's more, the mere fact that the sums of the 0th, first, second, third, fourth, fifth, sixth, and seventh powers of those two integer sets, [1, 19, 20, 51, 57, 80, 82] and [2, 12, 31, 40, 69, 71, 85], happen to agree is in itself pretty remarkable, though far from unique: this particular equation belongs to the branch of Multigrade Diophantine Equations which you can get to know by visiting the link, after which I'm sure you'll agree it's a pretty enthralling topic, with many recreational aspects.
3 - Simple
"Write a program to output all machine-representable real roots of the equation:
Once this funny realization is over, however, it remains the hardly trivial task of generating and outputting each and every machine-representable value in order, at least in theory (running time would be utterly preposterous), which varies from model to model. My original solution for the HP-71B is the following 2-line (54-byte) program:
1 DESTROY ALL @ N=TRAP(UNF,2) @ N=-INF @ DISP N which outputs in order every machine-representable value from -Inf to Inf, including such denormalized values as -0.00000000001E-499. The NEIGHBOR function merrily provides each value in turn, and the TRAP setting makes sure it will return denormalized values as well, for completeness' sake. Jean-François Garnier also discovered the use of NEIGHBOR and further provided a different method suitable for conversion to most any other model. Regrettably no RPN or RPL versions were provided, not even blind conversions of J-F's routine.
The Challenge: 1 - Simplest
Egan Ford was the first to stumble upon the amazing solution, which is (again) a kind of Multigrade Diophantine Equation, as seen above, and which depends on the parity of the number of 1's in the binary representation of the set elements 0, 1, ..., 15.
Of course, the ideal HP model for "binary tasks" is the HP-16C, and here is my original 9-step solution for it: 01 LBL AThe solution is pretty general and works for upper limits other than 15 (such as 3, 7, 31, 63, 127, etc). For 15, it requires DEC mode, and WSIZE >= 5 in 2's-Complement mode, or WSIZE >= 4 in Unsigned mode (if the upper limit of the set were 31, you would use WSIZE >= 6 and >= 5, respectively; similarly for larger or smaller upper limits).
To run it, simply previously store the upper limit in register I and execute GSB A: each element of the set will be displayed, in reverse numerical order, with elements belonging to the first subset being displayed as is, while elements belonging to the Complementary subset will be displayed with the "C" (for "Complementary") annunciator being turned on, like this: 15, STO I, GSB A -> 15 d (belongs to the first set)
the solution thus being: first set : [ 0, 3, 5, 6, 9, 10, 12, 15 ] and the sums of their 0th, first, second, and third powers are 8, 60, 620, and 7200 in both cases (the fourth powers differ, of course: 89924 and 88388, respectively).
An equivalent generalized HP-71B solution would be, for instance: 10 DESTROY ALL @ INPUT "K=";K @ FOR N=0 TO 2^K-1
where positive elements belong to the first set, negative elements to the complementary set. A solution for the HP-10C can be written very easily in a few dozen steps, but I've been unable to check it 2 - Simpler
Thus, the very same routine will produce the identical sets that, apart from having their respective sums of powers equal, as seen above, also have the additional property of resulting in the same pairwise sums.
So, all the generalized solutions above apply and if you discovered this awesome fact you would get two birds for the price of one ! :-)
My original solutions for the last three, much more substantial remaining subchallenges will follow in Part 2.
Re: Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special "Oh So Simple !..." - Valentin Albillo - 04-21-2008 Hi, Max:
Max posted:
Logically, the time required to concoct, create original solutions, and format and post them has likewise increased, while at the same time participation has decreased to the point that only a handful of people dare to attack them, even when they actually aren't that difficult really. See for example the training problem which essentially asked for a program to output every machine-representable number. This was allegedly interesting and challenging and not difficult at all; Jean-François provided a solution which could be easily ported to every machine out there and not specially difficult to discover from scratch. Yet apart from him, no one posted a thing. This being so, I think it's time to end the series because of diminishing returns, and will stick instead to simpler mini-challenges for a while. "Greetings, Max (looking forward to your solutions - even got myself a MATH ROM for my 71B since the last challenge, so that I can, at least, type them into the calculator myself)"
Best regards from V.
Re: Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special "Oh So Simple !..." - Valentin Albillo - 04-21-2008 Hi, Jean-François:
I look forward to see you participate in future mini-challenges, which will probably be centered around the HP-15C and the HP-71B, my two favorite models since ever. Thanks for your continued interest and appreciation, and
Re: Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special "Oh So Simple !..." - Valentin Albillo - 04-21-2008 Hi, Peter: Peter posted:
"I would believe that there is a nice crowd of silent followers who greatly enjoy your challenges and the thread of responses."
"From your perspective it must be hard to tell if a challenge is ignored or feverishly worked upon."
in wishful thinking so if I get silence, I assume there's no one there and move on. Otherwise I'd feel as if I was deluding myself, and there's no need for that, I've got many other things to do. 'Preaching in the desert' wasn't made for me, I only like to 'preach' or 'teach' to interested, existing audiences :-)
"let me throw my vote in the hat for keeping your
As for the regular S&SMC, if you're a Star Trek fan, like me, you'll certainly remember the title of the Next Generation series finale: "All Good Things ..."
Best regards from V.
Re: Last chance (Re: Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special) - Valentin Albillo - 04-21-2008 Hi, Egan:
Within 24 hours I'll post the remaining solutions, so I sincerely hope you'll be able to make it. It's already some 21 days since I posted the challenge and the start of the thread risks disappearing on its way towards the Archives, which would render it incomplete ... :-)
Re: Short & Sweet Math Challenges - Valentin Albillo - 04-21-2008 Hi, Karl: Karl posted:
I'm continually astounded, though, how certain people have always been able to post working solutions so quickly after you post the challenge -- oftentimes before I've even had a chance to see it.
"There are many things that need to be done, but which would not get done if I/we invested free time in
"My contributions in the MoHPC Forum tend to address known practical issues of HP calculators: identify the specific problem, and provide a concise assessment of its root cause."
"No one should complain if you decided to "call it day" regarding your S&SMC's. 20 of these is a very impressive body of work in itself (along with your may other contributions)."
"A short article containing links to your issuance and solutions to each challenge in the Forum Archives would be a welcome addition to the Articles
Thanks for your useful comments and
Best regards from V.
Re: My Original Solutions and Comments - Part 1 (Re: S&SMC#20) - Fernando del Rey - 04-21-2008 Dear Valentín, Just a couple of lines from someone who has dedicated some time to work on the S&SMC#20 challenges (though admittedly not enough time), without reaching anything that would be worth posting on the Forum. I’m pretty sure there are many others anonymous readers like me, who have enjoyed the challenges and the ingenious responses from the clever people in this Forum. Even though I have not contributed back, I still fully appreciate your efforts and those of the other contributors, and wish to publicly thank you for it. And if I may ask for a wish: why don’t you make the S&SMC a once-per-year event, always on April 1st. It would make a nice tradition in this Forum. Still, if you call it quits on #20, I must say you’ve done more than enough. I will look forward to your mini-challenges.
Regards, Re: My Original Solutions and Comments - Part 1 (Re: S&SMC#20) - Valentin Albillo - 04-21-2008 Hi, Fernando:
However, taking this last S&SMC#20 as an example, I began to research materials for it as early as January. Making a long list of suitable problems, refining it to a short list, then programming my own original solutions to the problems (including lots of test cases, optimizing, and debugging) took the remaining time till I posted the result last April 1st. In other words, a lot of free time used for this and a lot of work. Even if once a year. And the participation, however high-level it might be, just doesn't warrant it. Thinking otherwise amounts to delusion, which I'm not prone to. So I'll stick to mini-challenges for now. Thanks a lot for your interest and kind words, it's a pity I never got to see your solutions (or even attempts at solving my challenges). I know you are fully capable to solve them all hands down if given just a tiny amount of free time, which regrettably I also know you simply don't have.
Re: Last chance (Re: Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special) - Egan Ford - 04-21-2008 Thanks for the extra time. Unless an Ah-ha! strikes before I sleep I am afraid all I have is a solution that will correctly find the index only if it is prime. The composite indexes still elude me.
Incomplete 71B entry (bold are wrong): K= 2 X1= 15 INDEX= 67 REM= .268656716418Code: 10 DESTROY ALL @ OPTION BASE 0
Edited: 21 Apr 2008, 6:33 p.m.
Re: Last chance (Re: Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special) - Eamonn - 04-22-2008 Nice Work Egan. I am in more or less the same boat as you - I have an algorithm that works for the cases where the index is prime. Kudos to you though for submitting an actual solution for a programmable calc. Having spent quite a bit of time on this problem over the past few weeks, I am really looking forward to seeing Valentin's solution. I am pretty sure that I will learn a lot from it, as usual. Best regards,
Eamonn.
Re: Last chance (Re: Short & Sweet Math Challenge #20: April 1st, 2008 Spring Special) - Egan Ford - 04-22-2008 Thanks. Here's more stuff. If you replace lines 10-80 with: 5 DESTROY ALL @ OPTION BASE 0 @ DIM X(6) @ DIM Y(8) @ DIM Z(6)You can generate the following table (errors in bold): x1 k=2 k=3 k=4 k=6 k=8 k=102 minutes with EMU71. I didn't have time to test a physical 71B. I am guessing that it would have taken hours.
If any are interested I have qbasic versions as well. The above code runs in less than a second compiled with FreeBASIC. Edited: 22 Apr 2008, 9:52 a.m.
My Original Solutions and Comments - Part 2 (Re: S&SMC#20) - Valentin Albillo - 04-22-2008 Hi, all:
subchallenges #3 and #4 , which are much more substantial mathematically speaking than the ones already discussed in Part 1. Let's see:
The Challenge (Continued) 3 - Simple
only to Susan and their product only to Peter, both assumed to be ideally intelligent and honest students. She then asks if they can figure out what the original numbers are, and their dialogue goes as follows:
Peter: I'm sorry Ms. Germain but I can't figure out the numbers right now ... If they could, your HP can too, so write a program to find the two original numbers."
sufficient information to the participants so line 1 and 2 seem more or less a given while line 3 and 4 seem to reach a conclusion out of nowhere.
That's not so, of course, and on deeper analysis each line conveys some useful information that
Writing a program
10 DESTROY ALL @ OPTION BASE 1 @ DIM G$[195]
which makes use of my previous deduction that the sum must be odd and less than 54, as confirmed by the PDF document. If I hadn't
20 M=0 @ FOR S=4 TO 198 @ FOR X=2 TO S-2 @ IF FNF(X*(S-X)) THEN 40
where only the outer FOR changes to allow for the sum being anything between 4 (=2+2) and
4 - Less Simple
if you multiply each element by it, the set is now entirely composed of perfect powers."
Steve providing an early but simple solution which indeed technically solved the problem but resulted in highly non-optimized solutions, many orders of magnitude larger than necessary. His second attempt greatly improved on the first one, but still fell short of what was needed, which required a different approach. Nevertheless, his program is very small and his approach very clever so he certainly qualifies as a successful solver.
PeterP, on the other hand, did try for the more sophisticated approach, which involves
This is also the approach I originally took, with some variations, and this 23-line (849 byte)
1 DESTROY ALL @ OPTION BASE 1 @ INPUT "#=";N @ Z=4*N
which doesn't make any use of the JPC ROM as PeterP's extensively does (it wasn't allowed by
Upon running, it first asks for the number of elements in the set, then for the elements
>RUN and we can check that
2 * 27894275208 = 55788550416 = 2361962thus [ 2, 3, 4 ] * 27894275208 = [ 2361962, 43743, 1625 ]
so it does pass muster. This is a table of the respective solutions achieved with my program
As you can see, PeterP's solutions coincide with mine except for the case of the
By the way, my program (and obviously PeterP's as well) does produce a fairly optimized
[ 2, 3, 4] -> 23 * 320 = 27894275208 but
[ 3, 4, 2] -> 315 * 24 = 229582512
which is two orders of magnitude (i.e., around 100) times smaller. Thus, there's room for Further improvements of my program could include:
My original solution for the last, most difficult remaining subchallenge (#5) will follow in Part 3 Best regards from V. Edited to correct a typo
Edited: 22 Apr 2008, 10:12 a.m.
My Original Solutions and Comments - Part 3 (Re: S&SMC#20) [LONG and I mean it] - Valentin Albillo - 04-26-2008
Hi, all:
This is Part 3 of "S&SMC#20: My Original Solutions & Comments"
The Challenge (concluded)
5 - Least Simple "The sequence defined by
(n + 1) * xn+1 = n*xnk + xn
with k = 2 and x1 = 3, continues with
The fun factor here is that the task would be absolutely trivial were it not for the and so on till the last integer element at index 42, which has about 89,288,343,500 digits !!. The next element, x43, is *not* integer and, using the asymptotic formula: where C = 1.04783144758..., approximately evaluates to:
but a number more than 178 billion digits long isn't something that any current Consider also the extremely disconcerting mathematical nature of what's happening here: a simple recurrence which unfailingly produces a sequence of integer elements for the first 600 cases suddenly and most unexpectedly results in a non-integer one for case 601, and the same goes for other values of the parameters.
What to do ? Well, I see three possible approaches. On one extreme you could try using
The other extreme would be using as little multiprecision as possible or even none at all
My original solution is an intermediate one. I don't use the full multiprecision approach,
The only problem for me is that I wanted to implement my solution for the HP-71B which,
This isn't particularly easy, most specially as it must both run fast and be as small and compact
Main program (just 6 lines of HP-71B BASIC code implementing the base algorithm): As HP-71B's BASIC lacks any multiprecision operations, integer or otherwise, the main program simply calls the relevant library functions (you'll find a reasonably detailed description of the library in Apendix A below). The main program is executing the equivalent of the following pseudo-code: My original program is an implementation extensively relying in full multiprecision modular arithmetic, and taking into account the ideas discussed in the book "Mainly Natural Numbers" which you can freely download in PDF format from here. This particular problem is featured in Chapter IV: "Some Sequences of Large Integers", pp. 32-37., though the notation there differs slightly from mine; for instance my case k=2, x1=2, appears there as m=1, x1=2, etc. You're advised to read it for the rigorous analysis and relevant details, as space (and notational difficulty inherent to text-based HTML) does not permit to discuss the subject at lenght here.
Now this is a sample run for the case k=2, x1=41: where the running index is shown at steps of 10 while the computation is in progress, then the index of the first non-integer element is output (17), as well as its fractional part (0.235294117647) and the time it took to find it (1.53 seconds under Emu71, a little over 6 min. in a physical HP-71B).
The default precision listed above in line 10 is 200 digits, which is more than enough for all the cases
Running my program for the asked values, one gets the following results and times (for Emu71 @ 2.4 Ghz, single Pentium 4 CPU with and further this is a short table of extra results for comparison purposes with the book and/or your own programs (140 digits are more than enough so edit line 10 accordingly): Finally, this is an extensive table of results obtained with a different version of my ad-hoc library, which allows for much greater number of digits but takes at least one order of magnitude longer (the posted version can only handle slightly less than 500 digits, being limited by the exponent range of the built-in REAL precision, but it's smaller and much faster, and thus better suited for the cases asked in this subchallenge).
For each assorted x1 and k, two numbers are given: the index of the That's all. This "Short & Sweet Math Challenges" series exclusive to the MoHP ends its run now. The very first S&SMC#1 was posted in May, 27th 2002 at 9:59 a.m., so it's been nearly six years sharing what I hope has been interesting and rarely-seen math ideas and highly creative programming techniques for an incredible variety of HP (and non-HP) calc (and non-calc) models.
Thanks
Appendix A: The multiprecision library
I'll briefly discuss here the small (just 32 lines of code) "Ad-hoc multiprecision library" I've Ad-hoc multiprecision library:
70 !"Ad-hoc library" in this context means that it's tailored to do what the main program needs to do and absolutely nothing more, so it's mainly useful for the present purpose and not general-purpose by any stretch of the imagination. Thus, it has the following disclaimer attached:
Most of these shortcomings are the result of designing it to run fast, be small in size, and most importantly, take as little of my scarce free time as possible to develop and debug. On the positive side, you'll find that:
Available calls reference:
Note: In what follows,
SUB MMUL(A(),B(),C()) { Multiprecision MULtiplication }
Takes two multiprecision variables A and B and returns their product
SUB MPOW(A(),N,C()) { Multiprecision POWer }
Takes a multiprecision variable A and a single-precision value N
SUB MSUM(A(),B(),C()) { Multiprecision SUM }
in the multiprecision variable C. A and B are unaffected.
SUB MSBI(A(),B()) { Multiprecision SuBtraction In-place }
Takes two multiprecision variables A and B and returns their difference in the multiprecision
SUB MMODK(A(),K,M) { Multiprecision MODulus single-precision }
Takes a multiprecision variable A and a single-precision value K and returns
SUB MDIVK(A(),K) { Multiprecision DIV (and modulus) single-precision }
Takes a multiprecision variable A and a single-precision variable K and returns
SUB MNOR(A()) { Multiprecision NORmalization } Internal use only. Normalizes a multiprecision variable A in place
SUB MTOP(A(),U) { Multiprecision TOP }
Internal use only, though it can be useful for printing multiprecision variables, etc.
SUB M2N(A(),N) { Multiprecision to real-precision Numeric variable }
Returns in the REAL precision variable N the approximate value of the multiprecision
SUB N2M(N,A()) { Numeric Real-precision variable to Multiprecision }
Assigns the value of the REAL precision variable N to the
SUB MMOD(A(),B(),C()) { Multiprecision MODulus }
Takes two multiprecision variables A and B and returns the
SUB MFAC(N,A()) { Multiprecision FACtorial }
Takes the single-precision value N and returns its factorial in the Sample use:
Let's say we need to compute the following: This is how we would proceed (from the keyboard in this case):
1) DIMension several multiprecision variables capable of holding up to 100 digits (actually 102): 2) Make the necessary calls to the multiprecision library in order to perform the computation: 3) Output the multiprecision result (watch your WIDTH setting): > FOR I=P TO 1 STEP -1 @ DISP A(I); @ NEXT I @ DISP which is the correct result as shown above, disregarding the non-significant 0's at the beginning.
Re: My Original Solutions and Comments - Part 3 (Re: S&SMC#20) [LONG and I mean it] - Egan Ford - 04-29-2008 Valentin, et al, I have not given up on finding a solution without the use of multiprecision libraries or methods. Hopefully in time I will find one, but this thread will be long archived, so I'll post my summary now. I've written about 20 different programs in 4 different languages with various levels of success, but no single program finds all cases. To show that a calculator can solve even the most difficult case presented (k=3, x1=11) I created an HPGCC2 version of Valentin's method for the 50g with the following results:
k=2,x1=99 and k=3,x1=2 on my 50g outperform EMU71+PC by a wide margin. :-) Animation for the k=3,x1=11 case (replays every 10 seconds):
The f,x,y,z,m labels display the length in digits. The HPGCC2 source based on Valentin's algorithm is located at the end of this post. If any want the binary please email me. If any want to compile this or any of my C code for themselves, then read my HOWTO at: http://sense.net/~egan/hpgcc/. Two multiprecision libraries are included with this HOWTO. My best 71B BASIC program is only capable of finding prime indexes, but it is significantly faster than using multiprecision.
EMU71 results: >RUN >RUN >RUN My BASIC program compiled with FreeBASIC can find k=25,x1=9 (index=1451, special case (prime)) in seconds, but on the same PC with compiled C using Valentin's multiprecision method it takes about 1/2 a day. I must find a non-multiprecision method that works for all cases if one exists. :-) Valentin, Thank you for all your time and effort taken to create your many challenges. They do challenge me and I am sorry to see them go. I can only hope that the interest in your mini-challenges will encourage you to grant this community another SSMC next April Fools Day.
Code: 71B BASIC version (fails with composite indexes): 10 DESTROY ALL @ OPTION BASE 0 Valentin's Method in HPGCC2: #include <hpgcc49.h> int main() sys_slowOff(); x1 = sat_pop_zint_llong(); mp_init(&f); mp_init(&x); mp_init(&y); mp_init(&z); mp_init(&a); mp_init(&m); mp_init(&t); while(n+=10) {
Edited: 29 Apr 2008, 9:21 p.m.
Re: My Original Solutions and Comments - Part 3 (Re: S&SMC#20) [LONG and I mean it] - PeterP - 04-30-2008 Valentin, Thanks for all the time you stole away from other endeavors of your live to bring yet another challenge to us. As usually I enjoyed it a great deal, learned a lot and even allow myself a tinge of happiness in having gotten farther in this challenge than in most of my other attempts (although your gracious allowance to my deviation from some rules was most appreciated). And your free providing of a multi-precision library is a special goodie to end this sequence of challenges on a high note! I'll have to study the library carefully to understand it (maybe it even gives me some tips on how to write efficient multiplication and division routines in HP41 MCODE, something I am currently trying to learn and find info about) Thanks again and I can only second Egans hope that around April 1st you will allow me again to make a fool of myself by attempting your 'simple' challenge. Seriously, though, a very heartfelt Thank You! from your Austrian participant for all your kind work and advice you so freely give. Cheers
Peter
Re: My Original Solutions and Comments - Part 1 (Re: S&SMC#20) - Marcus von Cube, Germany - 04-30-2008 Hi Valentin, I was hoping to find the time to tackle some of the problems you posted in S&SMC#20 but my job simply didn't leave enough time. :( My HP-50g happily solved the prechallenge #2 and I found out about the identity in prechallenge #3. But that was it. (My knowledge about eigenvalues has faded away in the last 24 years.) What I still don't get is the reasoning behind challenges #1 and #2. What has the number of bits to do with the sum of powers or the pairwise sums? Is this an incident you need to know about or can it be deducted in an understandable way? Thanks again for your efforts which make me feel like an (April's) fool in most of the cases.
Marcus
Re: My Original Solutions and Comments - Part 3 (Re: S&SMC#20) [LONG and I mean it] - Valentin Albillo - 05-01-2008 Hi, Egan:
As you know, I don't specially like RPL models and that's the reason why I have none (save for a NIB HP28S) and further I've never been interested in them or produced programs for them, but I must confess that the way you use them, what with HPGCC, is truly amazing and fully shows their incredible capabilities to the best. Just for instance, the mere fact you can solve the k=3, x1=11 case is frankly awesome in the extreme, as it demands 4300-digit arithmetic at the very least, yet everything's concluded within a mere half and hour in a handheld calculator. Even sticking to the HP-71B, your non-fully multiprecision method is also outstanding, despite the fact that it doesn't solve all cases. The timing for that same case is also fantastic at 450+ seconds under Emu71. In short, I've been as enthralled with your productions as you might have been with mine, if not more, and (said in good humor, mind you) you're the main culprit of my S&SMC series being ended: you've forced me to raise the level to such heights, in order to actually provide a credible challenge that could hold your attacks even for a few days or hours, that most anyone else couldn't follow at all and quickly lost interest finding them completely over the top !! :-) Last, thank you very much for everything: your interest, your dedication, your insights, your amazing solutions. You've certainly been one of the main reasons for me enjoying it all and the best justification for my (considerable) efforts.
Re: My Original Solutions and Comments - Part 3 (Re: S&SMC#20) [LONG and I mean it] - Valentin Albillo - 05-01-2008 Hi, PeterP:
As for my ad-hoc multiprecision library, it's very ad-hoc, concocted in as little time as possible and with the minimum functionality needed, as stated in the disclaimer. If you're gonna develop multiprecision routines in HP41C's MCODE, better starting code
Thanks again, I'm keen to learn of your MCODE experiences, and
Re: My Original Solutions and Comments - Part 1 (Re: S&SMC#20) - Valentin Albillo - 05-01-2008 Hi, Marcus:
"My knowledge about eigenvalues has faded away in the last 24 years"
"What I still don't get is the reasoning behind challenges #1 and #2. What has the number of bits to do with the sum of powers or the pairwise sums? Is this an incident you need to know about or can it be deducted in an understandable way ?"
and simply googling for "Morse sequence" will report those and many extremely interesting links about it. There's also a number of books dealing with it and its awesome properties. For instance, though I only asked that Sum(x0), Sum(x1),Sum(x2), and Sum(x3) be equal for both subsets, actually the sums are also equal for *any* arbitrary 3rd-degree polynomial, i.e.:
Sum( 2*x3 + 0*x2 + 0*x1 + 8*x0 )
are also equal for both subsets and matter of fact I did consider asking for some such polynomials instead of the four discrete powers from 0 to 3, to make it even more puzzling and joke-like. "Thanks again for your efforts which make me feel like an (April's) fool in most of the cases."
Thanks a lot for your interest and kind support of my efforts, and
|