flat assembler
Message board for the users of flat assembler.

 Index > Heap > What is the best pie you can get with 9 digits? Goto page Previous  1, 2, 3 ... 23, 24, 25 ... 27, 28, 29  Next
Author
YONG

Joined: 16 Mar 2005
Posts: 8000
Location: 22° 15' N | 114° 10' E
YONG
revolution wrote:
Let's see if others here are happy to accept this notation for BBG.
I don't think many forum members are interested in this old game any more. Maybe we can start a new thread with a new game.

For example, let's see if we can come up with a zeroless pandigital approximation for pi. The rules are:

- Every digit from 1 to 9 must be used exactly once.
- No decimal point.
- Only basic arithmetic operations are allowed: +, -, *, /, (), power.

Here is my submission:

23519/7486 = 3.14173123163 ...

It is correct to three decimal places!

Refer to:
http://mathworld.wolfram.com/PandigitalNumber.html

28 Dec 2016, 03:52
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17269
revolution
YONG wrote:
I don't think many forum members are interested in this old game any more.
l4m2 seems determined to beat the current record. I personally would like to see it beaten.
28 Dec 2016, 09:17
YONG

Joined: 16 Mar 2005
Posts: 8000
Location: 22° 15' N | 114° 10' E
YONG
revolution wrote:
YONG wrote:
I don't think many forum members are interested in this old game any more.
l4m2 seems determined to beat the current record. I personally would like to see it beaten.
Accept whatever notation he would like to use. And then just let him win.

28 Dec 2016, 10:02
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17269
revolution
YONG wrote:
Accept whatever notation he would like to use. And then just let him win.
Something something keeping up the standards something something.
28 Dec 2016, 14:11
Tomasz Grysztar
Assembly Artist

Joined: 16 Jun 2003
Posts: 7718
Location: Kraków, Poland
Tomasz Grysztar
YONG wrote:
I don't think many forum members are interested in this old game any more. Maybe we can start a new thread with a new game.

For example, let's see if we can come up with a zeroless pandigital approximation for pi. The rules are:

- Every digit from 1 to 9 must be used exactly once.
- No decimal point.
- Only basic arithmetic operations are allowed: +, -, *, /, (), power.

Here is my submission:

23519/7486 = 3.14173123163 ...

It is correct to three decimal places!
Okay then:

397*65/8214

28 Dec 2016, 16:03
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17269
revolution
Tomasz Grysztar wrote:
397*65/8214
= 3.141587...
28 Dec 2016, 16:33
YONG

Joined: 16 Mar 2005
Posts: 8000
Location: 22° 15' N | 114° 10' E
YONG
revolution wrote:
Tomasz Grysztar wrote:
397*65/8214
= 3.141587...
Good! Correct to four decimal places.

29 Dec 2016, 01:50
YONG

Joined: 16 Mar 2005
Posts: 8000
Location: 22° 15' N | 114° 10' E
YONG
My new submission:

(876*34 + 25)^(1/9)

= (29784 + 25)^(1/9)

= 29809^(1/9)

= 3.14159149039 ...

Correct to five decimal places!

29 Dec 2016, 07:00
sleepsleep

Joined: 05 Oct 2006
Posts: 8884
Location: ˛　　　　　　　　　　　　　　　　　　　　　　　　　　　　　⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
is this trial and error or you guys got group of wizards behind?
29 Dec 2016, 07:26
YONG

Joined: 16 Mar 2005
Posts: 8000
Location: 22° 15' N | 114° 10' E
YONG
sleepsleep wrote:
is this try and error or you guys got group of wizards behind?
I can't speak for other forum members. Given that I work as a tutor for both local and overseas students, I have to deal with tricky math problems on a regular basis. Naturally, I came up with the submissions on my own -- partly by trial-and-error and partly by random moments of ingenuity.

29 Dec 2016, 07:36
Tomasz Grysztar
Assembly Artist

Joined: 16 Jun 2003
Posts: 7718
Location: Kraków, Poland
Tomasz Grysztar
YONG wrote:
My new submission:

(876*34 + 25)^(1/9)

= (29784 + 25)^(1/9)

= 29809^(1/9)

= 3.14159149039 ...

Correct to five decimal places!

I forgot that your list of basic operations did not include roots, so the new one I found is not going to count, unfortunately:
(sqrt(2)-1)*4983/657 = 3.141592361195...

I also found (1627/389)^(4/5) = 3.14159618798... but it is correct only to five places and not as good as yours.

sleepsleep wrote:
is this try and error or you guys got group of wizards behind?
I searched through some sets of expressions with a script written in fasmg - it is not the best choice in terms of performance, but I use such opportunities to test the fasmg engine with challenging tasks in order to find bugs. I found one very minor one this time, in the sequencing of mfree calls during the shutdown of assembler (it caused a crash in some rare cases).
29 Dec 2016, 20:58
YONG

Joined: 16 Mar 2005
Posts: 8000
Location: 22° 15' N | 114° 10' E
YONG
Tomasz Grysztar wrote:
your list of basic operations did not include roots ...
That is true. In fact, I faced a similar problem yesterday when working out my new submission.

So, the best submissions as of now are correct to 5 decimal places. See if any smart forum members out there can come up with something even better!

YONG: (876*34 + 25)^(1/9) = 3.14159149039 ...
T.G.: (1627/389)^(4/5) = 3.14159618798 ...

30 Dec 2016, 02:01
Tomasz Grysztar
Assembly Artist

Joined: 16 Jun 2003
Posts: 7718
Location: Kraków, Poland
Tomasz Grysztar
Got a new one, obtained through two distinct pandigital expressions:
6745/(2138+9) = (359-4)/(127-6-8) = 3.1415929203...
30 Dec 2016, 18:59
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17269
revolution
Tomasz Grysztar wrote:
3.1415929203...
An amazing coincidence.
30 Dec 2016, 19:28
YONG

Joined: 16 Mar 2005
Posts: 8000
Location: 22° 15' N | 114° 10' E
YONG
The 355/113 fraction is a well-known approximation for pi. That smells a bit like plagiarism to me ...

But the 6745/(2138+9) expression is fine. Good job!

So, the best answers as of now are correct to 6 decimal places.

T.G.: 6745/(2138+9) = ( 359 - 4 ) / ( 127 - 6 - 8 ) = 3.1415929203 ...

Come on! Let's see if some smart forum members can come up with something even better!

31 Dec 2016, 02:45
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17269
revolution
There are only 9! (362,880) ways to arrange nine digits. Writing a program to enumerate all possible expressions would be challenging but doable. And then add in the evaluator and comparator and this could be solved by brute force.
31 Dec 2016, 02:56
YONG

Joined: 16 Mar 2005
Posts: 8000
Location: 22° 15' N | 114° 10' E
YONG
revolution wrote:
There are only 9! (362,880) ways to arrange nine digits.
Did you count expressions like "9^7^5^3^12^46^8"?

31 Dec 2016, 04:28
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17269
revolution
YONG wrote:
revolution wrote:
There are only 9! (362,880) ways to arrange nine digits.
Did you count expressions like "9^7^5^3^12^46^8"?
No, I only mentioned the digits. It would be up to the expression generator to decide where to put the operators within the digits.
31 Dec 2016, 05:11
Tomasz Grysztar
Assembly Artist

Joined: 16 Jun 2003
Posts: 7718
Location: Kraków, Poland
Tomasz Grysztar
revolution wrote:
There are only 9! (362,880) ways to arrange nine digits. Writing a program to enumerate all possible expressions would be challenging but doable. And then add in the evaluator and comparator and this could be solved by brute force.
I used a simple expression generator (on top of a digit permutation) and fasmg's "eval" to find the above ones - but it does search trough some specific classes of expressions only, and becomes very slow when I allow for more complex ones. Even with a native program the exhaustive search on a personal computer is probably out of reach - consider just a variant of putting one of the six choices (empty string, +, -, *, /, ^) in the eight positions between the digits. This gives 9!*(6^8)=609,499,054,080 expressions, and it still just scratches the surface.

To generate all possible expressions I think it would be better to use RPN to deal with the operation ordering without brackets. So then it would go like this: take a permutation of digits, partition it into N (between 1 and 9) numbers and then distribute N-1 operators anywhere between or after these numbers, remembering that to generate a correct RPN expression you can put at most M-2 operators in the part of expression before the Mth number.
31 Dec 2016, 10:12
Tomasz Grysztar
Assembly Artist

Joined: 16 Jun 2003
Posts: 7718
Location: Kraków, Poland
Tomasz Grysztar
My "eval" searcher found me another one:
(2+6*9/743)*8^(1/5) = 3.14159288348...
It is still correct only to 6 places, but it is slightly closer to pi
31 Dec 2016, 12:14
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsCompiler InternalsIDE DevelopmentOS ConstructionNon-x86 architecturesHigh Level LanguagesProgramming Language DesignProjects and IdeasExamples and Tutorials Other----------------FeedbackHeapTest Area
Goto page Previous  1, 2, 3 ... 23, 24, 25 ... 27, 28, 29  Next

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou can attach files in this forumYou can download files in this forum