Skip to main content
Commonmark migration
Source Link

#PHP, 51 bytes

PHP, 51 bytes

An alternative PHP answer, but required the GMP extension to be installed:

<?=gmp_strval(gmp_nextprime($argv[1]-1))==$argv[1]; 

Simply subtracts 1 from the input and compares the nextprime result against the input

#PHP, 51 bytes

An alternative PHP answer, but required the GMP extension to be installed:

<?=gmp_strval(gmp_nextprime($argv[1]-1))==$argv[1]; 

Simply subtracts 1 from the input and compares the nextprime result against the input

PHP, 51 bytes

An alternative PHP answer, but required the GMP extension to be installed:

<?=gmp_strval(gmp_nextprime($argv[1]-1))==$argv[1]; 

Simply subtracts 1 from the input and compares the nextprime result against the input

Source Link
gabe3886
  • 221
  • 1
  • 6

#PHP, 51 bytes

An alternative PHP answer, but required the GMP extension to be installed:

<?=gmp_strval(gmp_nextprime($argv[1]-1))==$argv[1]; 

Simply subtracts 1 from the input and compares the nextprime result against the input