You can help CodeWalrus stay online by donating here. | New CodeWalrus | Old (dark mode) | Old (light) | Discord server
We have an anniversary Game Jam! Click here for more info.

The Walrii Prime

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

0
b/Other publicado por u/Yuki September 08, 2017, 10:11:41 PM
I just found a pretty interesting prime here:

222227772222222222222222222272227277222222222222222722222722722222222222227227727222272222222222227272277722227722222222227722272272227272222222227722272227227227222222272272272227272227222222272227727272722222722222772722222777222222722222727772272222222222722222722727772222222222272222722722272222222222272222722722272222222222272222722722272222222222272222727722272222222222272222727772722272222222227222727272722722272222227722727772722222227222222772277272722222222722722722277227222722222722722272272222777272222272272227272277222777722277727772277722222222277772222777

Or, if you rearrange it in a square:

222227772222222222222222
222272227277222222222222
222722222722722222222222
227227727222272222222222
227272277722227722222222
227722272272227272222222
227722272227227227222222
272272272227272227222222
272227727272722222722222
772722222777222222722222
727772272222222222722222
722727772222222222272222
722722272222222222272222
722722272222222222272222
722722272222222222272222
727722272222222222272222
727772722272222222227222
727272722722272222227722
727772722222227222222772
277272722222222722722722
277227222722222722722272
272222777272222272272227
272277222777722277727772
277722222222277772222777

As far as I know, this 576-digit number is prime (or have high probabilities to be prime according to the GNU Multiple Precision (GMP) library, someone should independently verify if you have a copy of Mathematica or something just checked with Wolfram Cloud, it's prime). Now if you want to Ctrl-F this page and search for 7...

Now you wonder how the hell I did that? It's a secret~

Code (PHP) Select

<?php// By [email protected]// Licensed under LiLiQ-R$im = imagecreatefromgif($argv[1]);$ix = imagesx($im);$iy = imagesy($im);function findprime($a,$b){  global $im,$ix,$iy;  $s="";  for($y=0; $y<$iy; $y++)  {    for($x=0; $x<$ix; $x++)    {      $c=imagecolorat($im,$x,$y);      $s.=($c>0)?$a:$b;    }  }  return gmp_nextprime($s);}$r=array();for($a=1;$a<=9;$a++){  for($b=0;$b<=9;$b++)  {    $n = findprime($a,$b);    $p = count(array_unique(str_split(gmp_strval($n))));    //echo $a." ".$b/*." ".gmp_sub($n, $s)*/." ".$p."\n";    if($p==2)    {      $z=array();      $z[]=$a;      $z[]=$b;      $r[]=$z;    }  }}for($i=0;$i<count($r);$i++){  echo $m=gmp_strval(findprime($r[$i][0],$r[$i][1]))."\n";  echo chunk_split($m,$ix);}


You must have GMP and GD installed in your PHP installation. Script should take about 45 seconds to run.

Of course, some of you will recognize the fact I was inspired by this video:

Last Edit: September 09, 2017, 02:28:55 AM by Juju
Inicia sesión o crea una cuenta para dejar un comentario
u/JWinslow23 September 09, 2017, 01:58:35 AM
I didn't think you'd actually do it! Or that it'd be so "clean" once someone found it (this is a literal perfect representation of the :walrii: , no extraneous or "wrong" digits).

Nice job, dude!
u/kotu September 09, 2017, 02:03:31 AM
nice code
u/Yuki September 09, 2017, 02:06:06 AM
Yeah, I'm kinda surprised I'd even find something. Actually, the last 3 digits are wrong, but of all the combinations of white and black pixels I tried, this was the only one that fits with the rest with no random digits.
u/kotu September 09, 2017, 02:07:28 AM
We still believe it's a prime

Thanks juju
u/_iPhoenix_ September 09, 2017, 02:16:02 PM
Dammit.

My [crappy, written in like 5 min to brute force the hell out of this problem] C code is still running. (It's been like 2 days, too)

I guess I'll let it keep running and see if it comes up with anything different.
Start a Discussion

b/Other

Any discussion that doesn't fit in other categories go here. Also, don't forget to introduce yourself. :)

232
Topics
Explore Board
Website statistics


MyCalcs | Ticalc.org | Cemetech | Omnimaga | TI-Basic Developer | MaxCoderz | TI-Story | Casiocalc.org | Casiopeia | The Museum of HP Calculators | HPCalc.org | CnCalc.org | Music 2000 Community | TI Education | Casio Education | HP Calcs | NumWorks | SwissMicros | Sharp Calculators
Powered by EzPortal