Tupper's 'Selfreferencing' Formula

05192022, 02:31 PM
(This post was last modified: 05192022 07:50 PM by matalog.)
Post: #1




Tupper's 'Selfreferencing' Formula
I have been trying to get Tupper's 'Self Referencing' Formula to plot on the Prime, just out of interest initially, and after I found out you can't, I wanted to do it even more.
This is a plot of Tupper's Formula, it has of course lost all meaning, as the Formula it plots isn't the Formula used to plot it. It was never self referencing anyway, as the main part of the Formula k, was never plotted in the result, but is the key to the 'bitmap' being plotted. This contains a routine to divide an arbitrarily large integer by a given number that the calculator can handle, and with division by 2, binary numbers extracted. It is the latter that takes so much time here. This isn't fast, and I have made it in faster ways, but it's shorter code, and for the time saving, not really a big difference. Code: EXPORT T2UP() 

05192022, 08:15 PM
(This post was last modified: 06012022 08:02 PM by OlidaBel.)
Post: #2




RE: Tupper's 'Selfreferencing' Formula
Interesting concept, thanks. again a mathematical curiosity.
How did you type , test and build this program ? Directly on the Prime screen or on a pc simulator ? I find the Prime not very comfortable to program because of the ugly coloured keyboard (G2), the small screen. Working on a PC is maybe the only way to program it comfortably … what do you think ?  HP 48GX, Prime G2, 50G. A long time ago : 11C, 15C, 28C, 28S. SwissMicros DM42, DM15L 

05192022, 10:43 PM
Post: #3




RE: Tupper's 'Selfreferencing' Formula
(05192022 02:31 PM)matalog Wrote: ⋮ Making adjustments to the formula to “white out” portions that are not of interest is fairly straightforward. The Wikipedia page used to mention some of the adjusted / derived formulas (that remove most of the solutions, leaving just a sliver), but doesn’t seem to currently. There is still a link to http://www.peda.com/selfplot/ which gives some examples. … but the precision required for the calculations is even higher… 

05202022, 08:43 AM
Post: #4




RE: Tupper's 'Selfreferencing' Formula
(05192022 08:15 PM)OlidaBel Wrote: Interesting concept, thanks. again a mathematical curiosity. I actually programmed the first long integer division part of this, lying on my bed, which isn't a comfortable place to code, but I wanted to get it done, and used the calculator itself. I prefer to sit at a desk, with a standard keyboard and decent screen obviously. I don't mind the keyboard much on the Prime, but yes, the orange colour for text on keys was a bad idea, they need a lot of light to be seen correctly. 

05202022, 03:04 PM
Post: #5




RE: Tupper's 'Selfreferencing' Formula
Hi, matalog
Instead of removing leading zeroes of quotient upfront, it may be simpler to fix afterwards. Getting a quotient automatically generated remainder (for free), we might as well return both. Code: function divmod(num, den)  NOTE: num = string of digits Note that r2 does not involve mod function, thus more efficient. If we don't care about quotient leading zeroes, after forend loop, we can simply return q, r lua> divmod('12345678901234567890', 111) 111222332443554665 75 

05202022, 08:46 PM
Post: #6




RE: Tupper's 'Selfreferencing' Formula
(05202022 03:04 PM)Albert Chan Wrote: Hi, matalog You refer to q2 as a string when you use Code: q = q .. q2 Code: local q2 = floor(r2/den) 

05202022, 08:55 PM
Post: #7




RE: Tupper's 'Selfreferencing' Formula
(05202022 08:46 PM)matalog Wrote: You refer to q2 as a string when you use q2 is a number, 0 to 9 For string concatenation, lua has implicit number/string conversion. To write code explicitly, it is q = q .. tostring(q2) 

05202022, 10:12 PM
Post: #8




RE: Tupper's 'Selfreferencing' Formula
Okay, I think that translates as:
lsd(number,divisor) BEGIN LOCAL Q:="0";LOCAL R:=0;LOCAL R2:=0;LOCAL Q2:=0;LOCAL K=0; FOR I FROM 1 TO size(number) DO R2:=10*R+(number(I)48); Q2:=FLOOR(R2/divisor); Q:=Q+STRING(Q2); R:=R2Q2*divisor; END; WHILE Q(1)==48 DO Q:=RIGHT(Q,size(Q)1); END; RETURN Q; END; That is 10 seconds faster for the purposes of this program, which is better. My other version that uses a general division routine for the string integer division by 17 and then uses a special only divide by 2 routine for all of the binary divisions, is 50 seconds faster than your method in the same program. Thanks for the info. 

« Next Oldest  Next Newest »

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