All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
To-day is Monday & a PIday (Posted on 2016-03-14) Difficulty: 4 of 5
The 9 numbers and 7 Xs of the set (1,2,3,4,5,6,7,8,9,X,X,X,X,X,X,X ) were placed in a 4x4 grid to create a matrix as follows:
X 4 8 9
5 6 X 7
1 X X X
3 2 X X
Consider the Xs as black squares in a crossword and evaluate the sum of the sums taken per row: Sr=489+(56+7)+1+32=585.
Same operation per column: Sc= 513+(46+2)+8+97=666
Evaluate the ratio r= Sr/ Sc=585/666= 0.878378...

Your task :
Distribute the 9 non-zero digits and 7 black squares in a 4x4 grid so
that the ratio r, calculated as in the example above will be as close
to the value of pi (=3.14159265…) as possible.

HaPPy Pi day, every Person.

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Hints/Tips computer-generated solving aid | Comment 1 of 13
355/113 is a good approximation to pi, so if you could get the totals to be these two, you've got a good approximation,   3.141592920353983.

333/106, the previous level in a continued fraction approximation, is not as good,  3.141509433962264.

Of course multiples of the numerator and denominator of each of these, such as 710/226, would be the same good approximations.

Combining the two numerators and two denominators can give good approximations also. For example, the worst approximation shown below, 3.14160263 which is 2862/911, is (9*355+1*333)/(9*113+1*106).  All are shown reduced to simplest form.

discrepancy    value     numerator/denominator
0.00000127   3.14159138  18083/5756
0.00000130   3.14159135  17728/5643
0.00000133   3.14159132  17373/5530
0.00000137   3.14159129  17018/5417
0.00000140   3.14159125  16663/5304
0.00000144   3.14159122  16308/5191
0.00000148   3.14159118  15953/5078
0.00000152   3.14159114  15598/4965
0.00000156   3.14159110  15243/4852
0.00000160   3.14159105  14888/4739
0.00000165   3.14159101  14533/4626
0.00000169   3.14159096  14178/4513
0.00000174   3.14159091  13823/4400
0.00000180   3.14159086  13468/4287
0.00000185   3.14159080  13113/4174
0.00000186   3.14159452  17417/5544
0.00000190   3.14159455  17062/5431
0.00000191   3.14159074  12758/4061
0.00000193   3.14159458  16707/5318
0.00000197   3.14159068  12403/3948
0.00000197   3.14159462  16352/5205
0.00000200   3.14159466  15997/5092
0.00000204   3.14159061  12048/3835
0.00000204   3.14159470  15642/4979
0.00000209   3.14159474  15287/4866
0.00000211   3.14159054  11693/3722
0.00000213   3.14159478  14932/4753
0.00000217   3.14159483  14577/4640
0.00000219   3.14159047  11338/3609
0.00000222   3.14159488  14222/4527
0.00000226   3.14159039  10983/3496
0.00000227   3.14159493  13867/4414
0.00000232   3.14159498  13512/4301
0.00000235   3.14159030  10628/3383
0.00000238   3.14159503  13157/4188
0.00000244   3.14159021  10273/3270
0.00000244   3.14159509  12802/4075
0.00000250   3.14159515  12447/3962
0.00000254   3.14159012  9918/3157
0.00000257   3.14159522  12092/3849
0.00000264   3.14159001  9563/3044
0.00000264   3.14159529  11737/3736
0.00000271   3.14159536  11382/3623
0.00000275   3.14158990  9208/2931
0.00000279   3.14159544  11027/3510
0.00000281   3.14158984  18061/5749
0.00000287   3.14158978  8853/2818
0.00000287   3.14159553  10672/3397
0.00000294   3.14158972  17351/5523
0.00000296   3.14159562  10317/3284
0.00000300   3.14158965  8498/2705
0.00000306   3.14159571  9962/3171
0.00000307   3.14158958  16641/5297
0.00000315   3.14158951  8143/2592
0.00000316   3.14159581  9607/3058
0.00000322   3.14158943  15931/5071
0.00000327   3.14159593  9252/2945
0.00000330   3.14158935  7788/2479
0.00000339   3.14158927  15221/4845
0.00000339   3.14159605  8897/2832
0.00000347   3.14158918  7433/2366
0.00000352   3.14159618  8542/2719
0.00000357   3.14158909  14511/4619
0.00000359   3.14159624  16729/5325
0.00000366   3.14158899  7078/2253
0.00000366   3.14159632  8187/2606
0.00000374   3.14159639  16019/5099
0.00000376   3.14158889  13801/4393
0.00000382   3.14159647  7832/2493
0.00000387   3.14158879  6723/2140
0.00000390   3.14159655  15309/4873
0.00000398   3.14158867  13091/4167
0.00000399   3.14159664  7477/2380
0.00000408   3.14159673  14599/4647
0.00000410   3.14158855  6368/2027
0.00000417   3.14159682  7122/2267
0.00000418   3.14158847  18749/5968
0.00000422   3.14158843  12381/3941
0.00000427   3.14158839  18394/5855
0.00000427   3.14159692  13889/4421
0.00000436   3.14158830  6013/1914
0.00000438   3.14159703  6767/2154
0.00000445   3.14158820  17684/5629
0.00000449   3.14159714  13179/4195
0.00000450   3.14158816  11671/3715
0.00000455   3.14158811  17329/5516
0.00000460   3.14159726  6412/2041
0.00000465   3.14158801  5658/1801
0.00000473   3.14159738  12469/3969
0.00000475   3.14158790  16619/5290
0.00000481   3.14158785  10961/3489
0.00000486   3.14158779  16264/5177
0.00000486   3.14159751  6057/1928
0.00000498   3.14158768  5303/1688
0.00000500   3.14159765  11759/3743
0.00000510   3.14158756  15554/4951
0.00000514   3.14159780  5702/1815
0.00000516   3.14158750  10251/3263
0.00000522   3.14158743  15199/4838
0.00000525   3.14159790  16751/5332
0.00000530   3.14159795  11049/3517
0.00000535   3.14158730  4948/1575
0.00000535   3.14159801  16396/5219
0.00000547   3.14159812  5347/1702
0.00000549   3.14158716  14489/4612
0.00000556   3.14158709  9541/3037
0.00000558   3.14159824  15686/4993
0.00000563   3.14158702  14134/4499
0.00000564   3.14159830  10339/3291
0.00000567   3.14158698  18727/5961
0.00000571   3.14159836  15331/4880
0.00000579   3.14158687  4593/1462
0.00000584   3.14159849  4992/1589
0.00000591   3.14158675  18017/5735
0.00000595   3.14158671  13424/4273
0.00000597   3.14159862  14621/4654
0.00000603   3.14158662  8831/2811
0.00000604   3.14159869  9629/3065
0.00000611   3.14159877  14266/4541
0.00000612   3.14158654  13069/4160
0.00000616   3.14158649  17307/5509
0.00000626   3.14159892  4637/1476
0.00000629   3.14158636  4238/1349
0.00000642   3.14159907  13556/4315
0.00000643   3.14158622  16597/5283
0.00000648   3.14158617  12359/3934
0.00000650   3.14159915  8919/2839
0.00000658   3.14158607  8121/2585
0.00000658   3.14159924  13201/4202
0.00000668   3.14158597  12004/3821
0.00000673   3.14158592  15887/5057
0.00000676   3.14159941  4282/1363
0.00000689   3.14158576  3883/1236
0.00000694   3.14159960  12491/3976
0.00000703   3.14158563  19060/6067
0.00000704   3.14159969  8209/2613
0.00000706   3.14158559  15177/4831
0.00000712   3.14158554  11294/3595
0.00000714   3.14159979  12136/3863
0.00000716   3.14158549  18705/5954
0.00000719   3.14159984  16063/5113
0.00000724   3.14158542  7411/2359
0.00000731   3.14158534  18350/5841
0.00000735   3.14160000  3927/1250
0.00000736   3.14158530  10939/3482
0.00000742   3.14158523  14467/4605
0.00000746   3.14158520  17995/5728
0.00000751   3.14160016  15353/4887
0.00000757   3.14160022  11426/3637
0.00000761   3.14158504  3528/1123
0.00000768   3.14160034  7499/2387
0.00000778   3.14158488  17285/5502
0.00000780   3.14160045  11071/3524
0.00000782   3.14158484  13757/4379
0.00000786   3.14160051  14643/4661
0.00000789   3.14158477  10229/3256
0.00000794   3.14158471  16930/5389
0.00000803   3.14158462  6701/2133
0.00000805   3.14160070  3572/1137
0.00000812   3.14158453  16575/5276
0.00000818   3.14158447  9874/3143
0.00000825   3.14160090  13933/4435
0.00000826   3.14158440  13047/4153
0.00000830   3.14158435  16220/5163
0.00000832   3.14160097  10361/3298
0.00000833   3.14158432  19393/6173
0.00000846   3.14160111  6789/2161
0.00000850   3.14158416  3173/1010
0.00000860   3.14160126  10006/3185
0.00000866   3.14158399  18683/5947
0.00000868   3.14160133  13223/4209
0.00000870   3.14158396  15510/4937
0.00000875   3.14158391  12337/3927
0.00000883   3.14158382  9164/2917
0.00000891   3.14158375  15155/4824
0.00000891   3.14160156  3217/1024
0.00000901   3.14158364  5991/1907
0.00000910   3.14160176  15730/5007
0.00000913   3.14158353  14800/4711
0.00000915   3.14160181  12513/3983
0.00000920   3.14158345  8809/2804
0.00000924   3.14160189  9296/2959
0.00000930   3.14158336  11627/3701
0.00000931   3.14160196  15375/4894
0.00000936   3.14158330  14445/4598
0.00000940   3.14158326  17263/5495
0.00000941   3.14160207  6079/1935
0.00000942   3.14158323  20081/6392
0.00000952   3.14160218  15020/4781
0.00000960   3.14158305  2818/897
0.00000960   3.14160225  8941/2846
0.00000969   3.14160234  11803/3757
0.00000975   3.14160240  14665/4668
0.00000978   3.14158287  19371/6166
0.00000981   3.14158284  16553/5269
0.00000985   3.14158280  13735/4372
0.00000992   3.14158273  10917/3475
0.00000997   3.14158269  19016/6053
0.00000998   3.14160263  2862/911

DefDbl A-Z
Dim crlf$


Private Sub Form_Load()
 Form1.Visible = True
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)
 
 pi = 4 * Atn(1)
 
 n1 = 333: d1 = 106
 n2 = 355: d2 = 113
 
 For frst = -50 To 50
 For scond = -50 To 50
  DoEvents
  If frst <> 0 And scond <> 0 Then
   If gcd(frst, scond) = 1 Then
     num = frst * n1 + scond * n2
     den = frst * d1 + scond * d2
     If num > 0 And den > 0 And Abs(pi - num / den) < 0.00001 Then
        g = gcd(num, den)
        num = num / g
        den = den / g
        Text1.Text = Text1.Text & mform(Abs(pi - num / den), "0.00000000") & mform(num / den, "###0.00000000") & "  " & num & "/" & den & crlf
     End If
   End If
  End If
 Next
 Next

 
 Text1.Text = Text1.Text & crlf & " done"
  
End Sub

Function gcd(a, b)
  x = a: y = b
  Do
   q = Int(x / y)
   z = x - q * y
   x = y: y = z
  Loop Until z = 0
  gcd = x
End Function

Function mform$(x, t$)
  a$ = Format$(x, t$)
  If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$
  mform$ = a$
End Function



  Posted by Charlie on 2016-03-14 09:05:33
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (6)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information