Join us on Discord!
You can help CodeWalrus stay online by donating here.
avatar_Yuki

The Walrii Prime

Started by Yuki,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yuki

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.
[close]

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

  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron
[html][/html][html][/html]
[html][/html][html]

JWinslow23

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!

kotu

  • Calculators owned: TI 84+CE-T
  • Consoles, mobile devices and vintage computers owned: Sega Master System, Sony PlayStation 3
SUBSCRIBE TO THE FUTURERAVE.UK MAILING LIST
http://futurerave.uk

Yuki

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.
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron
[html][/html][html][/html]
[html][/html][html]

kotu

We still believe it's a prime

Thanks juju
  • Calculators owned: TI 84+CE-T
  • Consoles, mobile devices and vintage computers owned: Sega Master System, Sony PlayStation 3
SUBSCRIBE TO THE FUTURERAVE.UK MAILING LIST
http://futurerave.uk

_iPhoenix_

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.
  • Calculators owned: Two TI-84+ CE's
Please spam here: https://legend-of-iphoenix.github.io/spam/

"walruses are better than tuxedo chickens, all hail the great :walrii:" ~ me
Evolution of my avatar:

Powered by EzPortal