12 deleted 172 characters in body
source | link

Golfscript / Javascript (125126 125 129 130 132 134 205 207)

Note that there are unprintable characters which are lost on SE. The count has been taken with UTF8 encoding, though. If you want to copy the source, do so from the Golfscript fiddle page.

Try Golfscript hereGolfscript here and Javascript hereJavascript here.

1.//"Helxanrrehmcrsghr+Hpths"Jg!uif!cptt!gjoet!uijt-!J!rvju/"{)(}%'
alert((/^1?$|^(11+?)\1+$/.test(Array(+prompt()+1).join(1))?"not ":"")+"prime");';#'

I'd say it's shockingly close to those Mathematica solutions which, afterall, have a built-in check for prime numbers.

Edit: Thanks to Peter for saving another two six bytes!

Here's some details:

  • The first 1. is needed because the following // is a comment in Javascript, but performs division twice in Golfscript. This will error out if nothing is on the stack, so we need to give it two numbers. Incidentally, 1. is a perfectly valid syntax in Javascript and will just be ignored.
  • "…"{)(}% takes the string, incrementsdecrements their character code values by one and pushes it as a string. This results in the string we need to print.
  • ' starts a string in Golfscript which by default extends over several lines, causing the Javascript below to only be put into the string.
  • Next is the Javascript code, which uses a somewhat well-known approach to detect prime numbers through regular expressions.
  • ';#' closes the multi-line string in Golfscript, discards it and then ignores the rest of the line. In Javascript, this is simply a string literal which will be ignored.

Golfscript / Javascript (125 129 130 132 134 205 207)

Note that there are unprintable characters which are lost on SE. The count has been taken with UTF8 encoding, though. If you want to copy the source, do so from the Golfscript fiddle page.

Try Golfscript here and Javascript here.

1.//"Helxanrrehmcrsghr+Hpths-"{)}%'
alert((/^1?$|^(11+?)\1+$/.test(Array(+prompt()+1).join(1))?"not ":"")+"prime");';#'

I'd say it's shockingly close to those Mathematica solutions which, afterall, have a built-in check for prime numbers.

Edit: Thanks to Peter for saving another two six bytes!

Here's some details:

  • The first 1. is needed because the following // is a comment in Javascript, but performs division twice in Golfscript. This will error out if nothing is on the stack, so we need to give it two numbers. Incidentally, 1. is a perfectly valid syntax in Javascript and will just be ignored.
  • "…"{)}% takes the string, increments their character code values by one and pushes it as a string. This results in the string we need to print.
  • ' starts a string in Golfscript which by default extends over several lines, causing the Javascript below to only be put into the string.
  • Next is the Javascript code, which uses a somewhat well-known approach to detect prime numbers through regular expressions.
  • ';#' closes the multi-line string in Golfscript, discards it and then ignores the rest of the line. In Javascript, this is simply a string literal which will be ignored.

Golfscript / Javascript (126 125 129 130 132 134 205 207)

Try Golfscript here and Javascript here.

1.//"Jg!uif!cptt!gjoet!uijt-!J!rvju/"{(}%'
alert((/^1?$|^(11+?)\1+$/.test(Array(+prompt()+1).join(1))?"not ":"")+"prime");';#'

I'd say it's shockingly close to those Mathematica solutions which, afterall, have a built-in check for prime numbers.

Edit: Thanks to Peter for saving another two six bytes!

Here's some details:

  • The first 1. is needed because the following // is a comment in Javascript, but performs division twice in Golfscript. This will error out if nothing is on the stack, so we need to give it two numbers. Incidentally, 1. is a perfectly valid syntax in Javascript and will just be ignored.
  • "…"{(}% takes the string, decrements their character code values by one and pushes it as a string. This results in the string we need to print.
  • ' starts a string in Golfscript which by default extends over several lines, causing the Javascript below to only be put into the string.
  • Next is the Javascript code, which uses a somewhat well-known approach to detect prime numbers through regular expressions.
  • ';#' closes the multi-line string in Golfscript, discards it and then ignores the rest of the line. In Javascript, this is simply a string literal which will be ignored.
11 added 8 characters in body
source | link

Golfscript / Javascript (129125 129 130 132 134 205 207)

Note that there are unprintable characters which are lost on SE. The count has been taken with UTF8 encoding, though. If you want to copy the source, do so from the Golfscript fiddle page.

Try Golfscript hereGolfscript here and Javascript hereJavascript here.

1.//"Helxanrrehmcrsghr+Hpths-"{)}/]""+'%'
alert((/^1?$|^(11+?)\1+$/.test(Array(+prompt()+1).join(1))?"not ":"")+"prime");';#'

I'd say it's shockingly close to those Mathematica solutions which, afterall, have a built-in check for prime numbers.

Edit: Thanks to Peter for saving another twotwo six bytes!

Here's some details:

  • The first 1. is needed because the following // is a comment in Javascript, but performs division twice in Golfscript. This will error out if nothing is on the stack, so we need to give it two numbers. Incidentally, 1. is a perfectly valid syntax in Javascript and will just be ignored.
  • "…"{)}/]""+% takes the string, increments their character code values by one and pushes it as a string. This results in the string we need to print.
  • ' starts a string in Golfscript which by default extends over several lines, causing the Javascript below to only be put into the string.
  • Next is the Javascript code, which uses a somewhat well-known approach to detect prime numbers through regular expressions.
  • ';#' closes the multi-line string in Golfscript, discards it and then ignores the rest of the line. In Javascript, this is simply a string literal which will be ignored.

Golfscript / Javascript (129 130 132 134 205 207)

Note that there are unprintable characters which are lost on SE. The count has been taken with UTF8 encoding, though. If you want to copy the source, do so from the Golfscript fiddle page.

Try Golfscript here and Javascript here.

1.//"Helxanrrehmcrsghr+Hpths-"{)}/]""+'
alert((/^1?$|^(11+?)\1+$/.test(Array(+prompt()+1).join(1))?"not ":"")+"prime");';#'

I'd say it's shockingly close to those Mathematica solutions which, afterall, have a built-in check for prime numbers.

Edit: Thanks to Peter for saving another two bytes!

Here's some details:

  • The first 1. is needed because the following // is a comment in Javascript, but performs division twice in Golfscript. This will error out if nothing is on the stack, so we need to give it two numbers. Incidentally, 1. is a perfectly valid syntax in Javascript and will just be ignored.
  • "…"{)}/]""+ takes the string, increments their character code values by one and pushes it as a string. This results in the string we need to print.
  • ' starts a string in Golfscript which by default extends over several lines, causing the Javascript below to only be put into the string.
  • Next is the Javascript code, which uses a somewhat well-known approach to detect prime numbers through regular expressions.
  • ';#' closes the multi-line string in Golfscript, discards it and then ignores the rest of the line. In Javascript, this is simply a string literal which will be ignored.

Golfscript / Javascript (125 129 130 132 134 205 207)

Note that there are unprintable characters which are lost on SE. The count has been taken with UTF8 encoding, though. If you want to copy the source, do so from the Golfscript fiddle page.

Try Golfscript here and Javascript here.

1.//"Helxanrrehmcrsghr+Hpths-"{)}%'
alert((/^1?$|^(11+?)\1+$/.test(Array(+prompt()+1).join(1))?"not ":"")+"prime");';#'

I'd say it's shockingly close to those Mathematica solutions which, afterall, have a built-in check for prime numbers.

Edit: Thanks to Peter for saving another two six bytes!

Here's some details:

  • The first 1. is needed because the following // is a comment in Javascript, but performs division twice in Golfscript. This will error out if nothing is on the stack, so we need to give it two numbers. Incidentally, 1. is a perfectly valid syntax in Javascript and will just be ignored.
  • "…"{)}% takes the string, increments their character code values by one and pushes it as a string. This results in the string we need to print.
  • ' starts a string in Golfscript which by default extends over several lines, causing the Javascript below to only be put into the string.
  • Next is the Javascript code, which uses a somewhat well-known approach to detect prime numbers through regular expressions.
  • ';#' closes the multi-line string in Golfscript, discards it and then ignores the rest of the line. In Javascript, this is simply a string literal which will be ignored.
10 please don't
source | link

Golfscript / Javascript (129 130 132 134 205 207)

Note that there are unprintable characters which are lost on SE. The count has been taken with UTF8 encoding, though. If you want to copy the source, do so from the Golfscript fiddle page.

Try Golfscript hereGolfscript here and Javascript hereJavascript here.

1.//"Helxanrrehmcrsghr+Hpths-"{)}/]""+'
alert((/^1?$|^(11+?)\1+$/.test(Array(+prompt()+1).join(1))?"not ":"")+"prime");';#'

I'd say it's shockingly close to those Mathematica solutions which, afterall, have a built-in check for prime numbers.

Edit: Thanks to Peter for saving another two bytes!

Here's some details:

  • The first 1. is needed because the following // is a comment in Javascript, but performs division twice in Golfscript. This will error out if nothing is on the stack, so we need to give it two numbers. Incidentally, 1. is a perfectly valid syntax in Javascript and will just be ignored.
  • "…"{)}/]""+ takes the string, increments their character code values by one and pushes it as a string. This results in the string we need to print.
  • ' starts a string in Golfscript which by default extends over several lines, causing the Javascript below to only be put into the string.
  • Next is the Javascript code, which uses a somewhat well-known approach to detect prime numbers through regular expressions.
  • ';#' closes the multi-line string in Golfscript, discards it and then ignores the rest of the line. In Javascript, this is simply a string literal which will be ignored.

Golfscript / Javascript (129 130 132 134 205 207)

Note that there are unprintable characters which are lost on SE. The count has been taken with UTF8 encoding, though. If you want to copy the source, do so from the Golfscript fiddle page.

Try Golfscript here and Javascript here.

1.//"Helxanrrehmcrsghr+Hpths-"{)}/]""+'
alert((/^1?$|^(11+?)\1+$/.test(Array(+prompt()+1).join(1))?"not ":"")+"prime");';#'

I'd say it's shockingly close to those Mathematica solutions which, afterall, have a built-in check for prime numbers.

Edit: Thanks to Peter for saving another two bytes!

Here's some details:

  • The first 1. is needed because the following // is a comment in Javascript, but performs division twice in Golfscript. This will error out if nothing is on the stack, so we need to give it two numbers. Incidentally, 1. is a perfectly valid syntax in Javascript and will just be ignored.
  • "…"{)}/]""+ takes the string, increments their character code values by one and pushes it as a string. This results in the string we need to print.
  • ' starts a string in Golfscript which by default extends over several lines, causing the Javascript below to only be put into the string.
  • Next is the Javascript code, which uses a somewhat well-known approach to detect prime numbers through regular expressions.
  • ';#' closes the multi-line string in Golfscript, discards it and then ignores the rest of the line. In Javascript, this is simply a string literal which will be ignored.

Golfscript / Javascript (129 130 132 134 205 207)

Note that there are unprintable characters which are lost on SE. The count has been taken with UTF8 encoding, though. If you want to copy the source, do so from the Golfscript fiddle page.

Try Golfscript here and Javascript here.

1.//"Helxanrrehmcrsghr+Hpths-"{)}/]""+'
alert((/^1?$|^(11+?)\1+$/.test(Array(+prompt()+1).join(1))?"not ":"")+"prime");';#'

I'd say it's shockingly close to those Mathematica solutions which, afterall, have a built-in check for prime numbers.

Edit: Thanks to Peter for saving another two bytes!

Here's some details:

  • The first 1. is needed because the following // is a comment in Javascript, but performs division twice in Golfscript. This will error out if nothing is on the stack, so we need to give it two numbers. Incidentally, 1. is a perfectly valid syntax in Javascript and will just be ignored.
  • "…"{)}/]""+ takes the string, increments their character code values by one and pushes it as a string. This results in the string we need to print.
  • ' starts a string in Golfscript which by default extends over several lines, causing the Javascript below to only be put into the string.
  • Next is the Javascript code, which uses a somewhat well-known approach to detect prime numbers through regular expressions.
  • ';#' closes the multi-line string in Golfscript, discards it and then ignores the rest of the line. In Javascript, this is simply a string literal which will be ignored.
9 added 6 characters in body
source | link
8 Rollback to Revision 6
source | link
7 added 4 characters in body
source | link
6 added 92 characters in body
source | link
5 added 828 characters in body
source | link
4 added 53 characters in body
source | link
3 deleted 325 characters in body
source | link
2 added 6 characters in body
source | link
1
source | link