hermann on Wed, 13 Nov 2024 16:02:01 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Fwd: Simple .pbm bitmap creation with PARI/GP


I know GP has many "plot*" functions, not sure whether b/w bitmaps can be created with that.

No library is needed for simple b/w predicate images:

$ x=14151 y=526 k=12 gp -q < s.gp | pnmscale 10 | pnmtopng > 12.png
pnmscale: promoting from PBM to PGM
pnmtopng: 2 colors found
$

https://www.mersenneforum.org/filedata/fetch?id=1060721

{
  x=eval(getenv("x"));
  y=eval(getenv("y"));
  k=eval(getenv("k"));
  print("P1\n#\n",2*k+1," ",2*k+1);
  forstep(b=y+k,y-k,-1,
    for(a=x-k,x+k,
      print1(isprime(a^2+b^2));
    );
    print();
  );
}

Regards,

Hermann.

-------- Original Message --------
Subject: Simple .pbm bitmap creation with PARI/GP
Date: 2024-11-12 01:57
From: hermann@stamm-wilbrandt.de
To: pari-users@pari.math.u-bordeaux.fr

Find small script in this github commit, and the created 1,000x1,000
bitmap of all gaussian primes for up to 1,000,000 in comment below:

https://github.com/Hermann-SW/RSA_numbers_factored/commit/6d48d3ede1cd5ead41f8ce9cebe2f75ff04a8da1

Regards,

Hermann.