[Question]
  [
# Background
A [super-prime](https://en.wikipedia.org/wiki/Super-prime) is a prime number whose index in the list of all primes is also prime. The sequence looks like this:
> 
> 3, 5, 11, 17, 31, 41, 59, 67, 83, 109, 127, 157, 179, 191, ...
> 
> 
> 
This is [sequence A006450 in the OEIS](https://oeis.org/A006450).
# Challenge
Given a positive integer, determine whether it is a super-prime.
# Test Cases
```
2: false
3: true
4: false
5: true
7: false
11: true
13: false
17: true
709: true
851: false
991: true
```
# Scoring
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest answer in each language wins.
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 5 bytes
```
ÆRÆNċ
```
[Try it online!](https://tio.run/##y0rNyan8//9wW9DhNr8j3f8Ptz9qWgNE7v//R0cb6yiY6igYGgKxuY6CuYGljoKlpWGsDpdCtJGOgomOggJQ2BCoysLUUAEEYmMB "Jelly – Try It Online")
### How it works
```
ÆRÆNċ  Main link. Argument: n
ÆR     Prime range; yield the array of all primes up to n.
  ÆN   N-th prime; for each p in the result, yield the p-th prime.
    ċ  Count the occurrences of n.
```
[Answer]
## Mathematica, ~~26~~ 23 bytes
*Thanks to user202729 for saving 3 bytes.*
```
PrimeQ/@(#&&PrimePi@#)&
```
This makes use of the fact that Mathematica leaves most nonsensical expressions unevaluated (in this case, the logical `And` of two numbers) and `Map` can be applied to any expression, not just lists. So we compute the `And` of the input and its prime index, which just remains like that, and then we `Map` the primality test over this expression which turns the two operands of the `And` into booleans, such that the `And` can then be evaluated.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 6 bytes
```
ÆRi³ÆP
```
[Try it online!](https://tio.run/##y0rNyan8//9wW1Dmoc2H2wL@//9vaGkIAA "Jelly – Try It Online")
Uses the same technique as my Japt answer: Generate the primes up to **n**, get the index of **n** in that list, and check that for primality. If **n** itself is not prime, the index is **0**, which is also not prime, so **0** is returned anyway.
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~13~~ 11 bytes
```
õ fj bU Ä j
```
[Test it online!](http://ethproductions.github.io/japt/?v=1.4.5&code=9SBmaiBiVSDEIGo=&input=OTkx)
### Explanation
This is actually very straight-forward, unlike my original submission:
```
 õ fj bU Ä  j    
Uõ fj bU +1 j    Ungolfed
                 Implicit: U = input integer
Uõ               Generate the range [1..U].
   fj            Take only the items that are prime.
      bU         Take the (0-indexed) index of U in this list (-1 if it doesn't exist).
         +1 j    Add 1 and check for primality.
                 This is true iff U is at a prime index in the infinite list of primes.
                 Implicit: output result of last expression
```
[Answer]
# Regex (Perl / PCRE), ~~55~~ ~~54~~ 53 bytes
```
^(?=((?=((\2x*?|^)((?!(xx+)\5+$)))xx)x)*(x*))\6(?4)xx
```
[Try it online!](https://tio.run/##RU7LTsMwELz3K0xlNd48VKciHHDcpFK5cuJGWqugVrJk2mAHyciYXw/bgMRhVzujmZ3pj9ZU49snoVaQYC6vB0PoUiCU9XbztFnH2eliGXWSi3otIBB9QgSht/o8kHl3notIWiNdb/TAkiLJ3ceLG9Ci8qLMSzi@X0XNP8uRh3uqQFx/OUw82NbUKwiteS53EjffiTgjZErWfwTVtZwEeGUZBPSyxCeeapDfS2qXEKhbLKZeUy3sXIrfmlSLGKNSD49bpcY9aySbplv5tPnaA6Ib5n0GXZVRAPAePKTMpwDdHWtukRhHXpQV5z8 "Perl 5 – Try It Online") - Perl  
[Try it online!](https://tio.run/##XVBNa@NADL33V6jDgKXESeyQtISJ8aVdKJQednuL28H1TmqzzngYT2Gg29@eymFPe5DQk/SePlzrzvvStQ6khwLESsASnDfv2hvX143BZLWclVq3dR90M5xc1xtfYUWq@rkakxQStiMn9buZGmwwNoyo9Y@Hx3utKYWcWJKFFXS206MJKFzjzfKtbv4Ez0733akLIgWxWe82u5vb9W4rSF0dB4@yKzIl@@LI6iP@er57eCJFn9AdUfaHMfjeWI5okb8UhaisIG4eP964wuk0Sxc5TXwTXT/8NigWIuV2xfxm@LBh4u7XTDqwAPvsRV0BXCbbf1jafXGpczSfE48GvHzoVIemRelTHja9y9QBk5ik0hIRfE4rdmSadpj2UsCn5AomDNKqr6//foqkzq9YFnixah1n5d9XYnSNMc6p2s4ly8ZIkWYYZ0TVDZYbTpzP2SLfZtk3 "PHP – Try It Online") - PCRE
Takes its input in unary, as a string of `x` characters whose length represents the number. Based on [Prime counting function](https://codegolf.stackexchange.com/questions/94348/prime-counting-function/222468#222468).
```
^       # tail = N = input value
(?=
    # Calculate π(N) = the number of primes <= N, by counting
    # from the largest to the smallest prime.
    (       # J = 0
        (?=
            # \2 starts at zero, and on each subsequent iteration, contains the
            # difference N-P-(J-1) where P is the previously found prime, and J
            # is the running total of our prime count.
            (
                (
                    \2           # Start from the previous value of \2. This
                                 # will make tail = P-1, where P is the
                                 # previously found prime.
                    x*?          # Advance as little as necessary to make the
                                 # following match, and add this to \2, while
                                 # subtracting it from tail.
                |        # or
                    ^            # Don't advance at all on the first iteration
                                 # (when \2 is is still unset), so as to assert
                                 # that N is not composite.
                )
                ((?!(xx+)\5+$))  # Define and use subroutine (?4): Assert tail
                                 # is prime. Note that this needs to be inside
                                 # group \2 for it to work in PCRE1 and older
                                 # versions of PCRE2, which atomicize groups
                                 # that have nested backreferences.
            )
            xx                   # Assert tail is prime by eliminating the
                                 # false positives 0, 1
        )
        x   # J += 1; tail -= 1
    )*      # Iterate zero or more times, until there are no smaller primes
            # remaining.
    # At this point, head = π(N), and tail = N - π(N)
    (x*)    # \6 = tail = N - head = tool to make tail = head
)
\6          # tail = π(N)
(?4)xx      # Assert tail is prime
```
Alternative **~~55~~ ~~54~~ 53 bytes**:
```
^(?=((?=((\2x*?|^)((?!(xx+)\5+$|x?$))))x)*(x*))\6(?4)
```
[Try it online!](https://tio.run/##RU7LasMwELznK9QgYq0fWA51D5UVO5Bee8qtTkRaEhCoiSu5oKKov@4qaqELu@wMOzszHLWqp/cvhDVDTl3eDgrhkgXIm816u1752emiCTacsmbFwCF5CgjcoOV5RPP@PGcedYqbQcmRJEWSm89XMwaJyIsqr@D4cTtq/1kaeHjEAtjtlwmOB92pZgmuUy/VjodJd8zPEIrO8o/AsuHxIGxZBi5oSWITiyXw7xLrEhw2i0XMFWOFzBX7jYkl894L8fS8EWLak5aT2P3Spu11DwHdEWsz6OsMX22LIZSFlNgUoH8g7T1MEy2qmtIf "Perl 5 – Try It Online") - Perl  
[Try it online!](https://tio.run/##XVBNS8NAEL37K8ZlITNt2ialVco25KKCIB7UW6NLjFsTTDfLZoWA@tvrpHjyMMO8mXlvPlztjtvc1Q6khwzEQsAcnDfv2hvXlpXBaDGf5FrXZRt01R1c0xpfYEGqeFj0UQwR256T@t2MDTYYG3rU@ub27lpriiEllmRhBY1tdG8CCld5M38tq4/g2em2OTRBxCBWy81qc3G53KwFqbN951E2WaJkm@1ZvcfHp6vbe1L0Bc0eZbvrg2@N5Yhm6XOWicIK4ub@85UrnI6TeJbSyDeDa7s3g2ImYm5XzK@6TxtG7nbJpB0LsE@e1RnAabL9w9Jus1Odo@mUeDTg6UOHMlQ1Sh/zsPFdpgwYDVEsLRHB17hiQ6aqu3EvBXxKqmDEIK36@fn3UyR1fME8w5MVy2GSf78Qo3MchikV66n8HnLJ0jTQBIcJUXGB@YqOx2SWrpPkFw "PHP – Try It Online") - PCRE
This eliminates the false negatives \$0\$ and \$1\$ in the definition of the primality subroutine instead of patching its ~~second and third~~ individual uses.
# Regex (.NET), ~~70~~ ~~60~~ 58 bytes
```
^(?=(\3*?(?!(xx+)\2+$)(x))*x)(?<-3>x){2,}(?<!\3|^\4+(x+x))
```
[Try it online!](https://tio.run/##RY9Ra4MwFIX/ipUL3pimaN1e6jILe94vUAti0xnIEokphjp/u9ONsbfznXM53NObUdihE0otYHlpxYfw9emkxYjnaLlgwbHK4gKLHXpPSXWkQNATEnuCxQvLXj2Zjvt51bsq@7pUTxQ9XfMlOu/DN/PZSyWuIcnhwZP8Zqxo2g5BBVIHIHV/d2SChoNiQ6@kC1mYyxtCc2jNXTumXHDcDiiHpkzqeS1A0LyU2tU/Tg6aKfHH6caUkmnrsIf3xrWdGDDyUQya/NoPMo1WOsE6M7h5fSvN/zlg2qzTldQiAD3P85Kw9DlJvgE "PowerShell – Try It Online")
This uses the .NET feature of balanced groups to do the prime counting. Since .NET regex has no subroutines, this has ~~three~~ two copies of the primality test.
```
^                      # tail = N = input value
# Calculate π(N) = the number of primes <= N, by counting
# from the largest to the smallest prime.
(?=                    # Atomic lookahead - lock in this match once it completes
    (
        \3*?           # Advance as little as necessary to make the following
                       # match, but don't advance at all on the first iteration
                       # (when \3 is is still unset), so as to assert that N is
                       # not composite.
        (?!(xx+)\2+$)  # Assert tail is not composite
        (x)            # Eliminate the false primality positive of 0, and advance
                       # forward so that the next prime can be found (if we didn't
                       # do this, the regex engine would exit the loop due to a
                       # zero-width match); \3 = 1, to signal the first iteration
                       # has been done, and push a capture onto the Group 3 stack.
    )*                 # Loop as many times as can be done until its stops
                       # matching.
    x                  # Eliminate the false primality positive of 1
)
(?<-3>x){2,}           # Pop all Group 3 captures off the stack, asserting that
                       # the count is ≥ 2, and doing head += 1 for each one. Since
                       # this isn't done atomically, we need to subsequently
                       # verify that all captures were popped, due to backtracking
                       # if the following assertion fails.
(?<!\3|^\4+(x+x))      # Assert that the Group 3 capture stack is empty, and that
                       # head is not composite (and since it's already been
                       # forced to be ≥ 2, this asserts it to be prime).
```
# Regex (Perl / Java / PCRE / .NET), 60 bytes
```
^(?=((?=((\2x*?|^)(?!(xx+)\4+$))xx)x)*(x*))\5(?!(xx+)\6+$)xx
```
[Try it online!](https://tio.run/##RU5LT8MwDL7vV4QpWuM@1HSiHEizdtK4ctqNbtFAmxQpbCUpUlAIf71kAcHBlv097G84alVPrx8Ia4acurwcFMIlCytvNuvteuVnp4sm2HDKmhUDh@QpbOAGLc8jmvfnOfOoU9wMSo4kKZLcvD@bMVhEXlR5Bce3q6j9R2nA4R4LYNdbJnw86E41S3Cdeqp2PHS6Y36GUPwsfwEsGx4FYcoycMFLEptYLIF/lViX4LBZLGKuGCtkrthPTCyZ916Ih8eNENOetJzE6pc2bT/3QNobYm0G/W2GAawFCymxKUBf/1F3gbJ2mmhR1ZR@Aw "Perl 5 – Try It Online") - Perl  
**[Try it online!](https://tio.run/##bVJhT9swEP3OrziiTbXTYlI09mEmqrZpk5DGNsHHtkhu4rQGx8lshxoYv707pxkbEpEi@@6d3/k93424E0c35e1O1W1jPdxgzFTDUg7/Zzqv9Ks5K9cyIHLQdiutCii0cA4uhDLwCEPOeeFxuWtUCTUi5MpbZdYg7NrNlxT8xjZbB19CIVuvGjx5APBVaQlVbuS235KEFU0pGeIJ5Z@6qpJWlpdSlNLCqi97mSR/Tw5hRSkf@rqJ59tN5CfE5SvUIMpvykhC6WFuOq2pqohj8lcntCPJcZqmCaWPL0v3DIT4VwkekcE/MyDBMTKssO6Wu3E@WphRXD1/2ueefgrvpTVg82GHaus2NnCUoxurptFSGHjIK2SUHK4KYQxKV6btPOQQ1Q45cnXvvKyZMpTDoLMvYxvhvsvg8Zq9xQCDIRrvjhz7IoMVg8QBny9BIxyrmGu18iQ5wkfAeg8mQ@TceBwDy1phncSA6Hm2pBMw01dBpqVZ@83ZCcwgVsIHXKZLZCw2ws6XYdDTR2a65PDRWnHvWKW0JmEyCqPeFICqsVEbXiM3GQdzlpspLuMxCrwQvtigQzWyWVbvI9JPrsEB/4zk@4lhWytaMrQomvb@R3UpzFpip2xiKI1KKyA1tjclehff9oEOJjfo2NYqL0l8VMofcm@7@D7/4BY99BVJ3roELaH8KX4Hcap212SWk/5fnIR09vuaktkhCWFMF@/GbygNgQaakpBSujh9ht4jFMIuTtUuO5qeZtkf "Java (JDK) – Try It Online") - Java**  
[Try it online!](https://tio.run/##XVBNa@NADL33V6jDgKXESeyQtISJ8WW7UCh72O2tbgfXndRmnfEwnsJAt789lUPZQw8Skp7e04dr3WlfutaB9FCAWAlYgvPmVXvj@roxmKyWs1Lrtu6Dboaj63rjK6xIVb9XY5JCwnbgon41U4MNxoYRtf55e3ejNaWQE0uysILOdno0AYVrvFk@183f4Nnpvjt2QaQgNuvdZnd1vd5tBamLw@BRdkWmZF8cWH3EP/c/bn@RonfoDij7hzH43liOaJE/FoWorCBuHt@eGeFymqWLnCa@ia4fXgyKhUi5XTG/Gd5smLj7NZMeWIB99qguAM6T7Vcu7b444xzN58SjAc8fOtahaVH6lIdN7zJ1wCQmqbREBO/Tih2Zph2mvRTwKbmCKQdp1cfHt58iqdMTlgWerVrHWfnvibC8xBjnVG3mkihGijTDOCOqtv@hK4ZiPJ2yRb7Nsk8 "PHP – Try It Online") - PCRE  
[Try it online!](https://tio.run/##RY9Ra4NAEIT/ipUFb7UXNDR9iBwG@txfoAbEbOrB9U7OCx6x/narKW0f5uGbWYbZ3oxkh46UWsCK0tIH@fp41DSyU7ScWSHYQ9Xex8XXGVnxxLxPsHpJANF79BgzHyNWh7/odY28X6LTc/hmPnup6BJiDneR5ldjqWk7BiqQOgCp@5vDCRoBig@9ki7kYS6vDJpda27aceWC/XaQCGjKtJ7XAgZalFK7@uHkoLmiX842ThKctg67e29c29HAIh/FoPHHvuM0WumId2Zw8zory/854NqszyupKQA9z/OS8uyQpt8 "PowerShell – Try It Online") - .NET
This is a straight port of the Perl/PCRE version, to regex engines that lack subroutine calls but support nested backreferences. The subroutine call has been replaced with a copy of the routine.
# Regex (Perl / PCRE / Python[`regex`](https://github.com/mrabarnett/mrab-regex)), 61 bytes
```
^(?=((?=((\6x*?|^)((?!(xx+)\5+$)))xx)(?=(\2))x)*(x*))\7(?4)xx
```
[Try it online!](https://tio.run/##RU7LTsMwELz3K0xlNd48VKciIOG4SaVy7Ykbaa2CWsmSaUMcJCNjfj1sAhKHXe3M7uxMe@pMMbx9EtoJ4s319WgIXQqEstxunjbrMDtfO0at5KJcC/BEnxGBbzt96cm8ucxFILWRtjW6Z1EWpfbjxfYoUWmWpzmc3sej6p/lyMMDVSDGXxYdj11tyhX42jzne4md70WYETI56z@C6lJOBzglCXjUsshFjmqQ30vaLcFTu1hMuaZYmDkXvzGpFiEEpR53W6WGA6skm6q5c3H1dQBEN8y5BJoioQDgHIz7ZoUjxMzFAM09q25xMQw8ywvOfwA "Perl 5 – Try It Online") - Perl  
[Try it online!](https://tio.run/##XVBNS8NAEL37K8ZlITNt2ialVco25KKCIB7UW6NLjFsTTDfLZoWA@tvrpHjyMMPMvHlvPlztjtvc1Q6khwzEQsAcnDfv2hvXlpXBaDGf5FrXZRt01R1c0xpfYEGqeFj0UQwR256L@t2MDTYYG3rU@ub27lpriiEllmRhBY1tdG8CCld5M38tq4/g2em2OTRBxCBWy81qc3G53KwFqbN951E2WaJkm@1ZvcfHp6vbe1L0Bc0eZbvrg2@N5Yhm6XOWicIK4ub@85URLsdJPEtp5JvBtd2bQTETMbcr5lfdpw0jd7tk0o4F2CfP6gzgNNn@5dJusxPO0XRKPBrw9KFDGaoapY952PguUwaMhiiWlojga1yxIVPV3biXAj4lVTDmIK36@fn3UyR1fME8w5MVF8Mk/34hzs5xGKZUrKeSZYeBRrxYckgTHCZExSXmKwaOx2SWrpPkFw "PHP – Try It Online") - PCRE  
**[Try it online!](https://tio.run/##NY/RboMwDEXf@Qov2kMMASXt1kmwiA8BKlVrKKmygJJMSqX9OyNse7Bk3@N7LS@PMM32uOrPZXYB/MMzp24qsrufbQNOOkLIeqatpHv1p5i332fcpicaY4H9a/GMiDFi4v1hazGnMUfs32j7soF1S@hEXYqhAS15Ns4ODGibjlU@XLWtMzDSVH4xOlBSEsxAj2CUpQbfDzWYTgzSdHzIIJltMruLvSmqbaAJIPvtxICFwC0vBeyPVF5d3MdEHQMSSW53mKiuYXHJNZovP0mBuy5F8yf74KhFpuxVEsL@l1ZeCs75Dw "Python 3 – Try It Online") - Python `import regex`**
This is a port of the Perl/PCRE version. `\2` is copied into `\6` using the lookahead `(?=(\2))`, since Python (even with `import regex`) lacks nested backreferences.
# Regex (PCRE / Ruby), 62 bytes
```
^(?=((?=((\6x*?|^)((?!(xx+)\5+$)))xx)(?=(\2))x)*(x*))\7\g<4>xx
```
[Try it online!](https://tio.run/##XVBNT8MwDL3zK0wUqfHWbe20gaas7AJISIgDcCMQlZKtFV0apUGKBPvtw504cbDlZ/s9f7jaHdcbVzvgHgpgMwZTcN7stDeuLSsjktl0tNG6Ltugq27vmtZ4JRRK9TjrkxQSsi0l9c4MDTYYG3qh9e3d/Y3WmEKOJEnCEhrb6N4EwVzlzfS9rD6DJ6fbZt8ElgJbzFeL1cXlfLVkKM@2nRe8KTLJ22JL6r14er6@e0CJ39BsBW9f@uBbYynCSf5aFExZhtTcf71ThdJplk5yHPgmurb7MIJNWErtkvhV92XDwF3PifRCAuSzV3kGcJps/zC36@JUp2g8RhoN4vShfRmqWnCf0rDhXaYMIolJyi0iwvewYoOmqrthLwl0Si5hwMCtPBz@/VSgPL6JTSFOpi7iaPPzhoTORYxjVMsxJ9kYcairOYU4EnGEqC7Vbr24ivF4zCb5Mst@AQ "PHP – Try It Online") - PCRE  
**[Try it online!](https://tio.run/##PY5Ba8MwDIXv@xVqGNRKiXHCuh1crxS66w5jt7g1G3VTg3GD41IPxv56ZoetBxm/p/dJ8pfPr9GDgDfd6dhTp6@w3bxvqNcfBw5GMA7Xk7EarOh0GO4AzBFsW9U7IQrpCp4atmWUVs2Og3aHlEgOHXprAplXc/xDqNWuCyeCqyYxbeITdkOOZw8OjINs0nBWhtQMKc3Bm0y5aRYpYlE6BPEDnmfDzPKd/SUM07x8d520Ny6A@1@R31xKvbxulRr3ZC3IVPIxluvvPSY1IzEuUC4X94gYI@a@bNIXSxJLRPkku9XDc4zjyKp6ydgv "Ruby – Try It Online") - Ruby**
This is a straight port of the Python[`regex`](https://github.com/mrabarnett/mrab-regex) version, to Ruby's subroutine call syntax.
# Regex (Perl / Java / PCRE / Python[`regex`](https://github.com/mrabarnett/mrab-regex) / Ruby / .NET), 68 bytes
```
^(?=((?=((\5x*?|^)(?!(xx+)\4+$))xx)(?=(\2))x)*(x*))\6(?!(xx+)\7+$)xx
```
[Try it online!](https://tio.run/##RU7LTsMwELz3K0xlNd48FKeiIOG4SaVy5cQNt1ZBrWTJtMEOkpExvx6cgOCwq9nZ2Z3pjkavhtcPhA1DXl9eDhrhksWR19vN42YdZqeLIdhyyuo1A4/UKU7gO6POPZqL85wF1GpuO616khRJbt@fbR9PZF5UeQXHt1HU/LM08nCHJbDxl42OB9Pqegm@1U/VjsdOdyzMEJqc1S@BVc0nQURZBj7eksQlDivgXyU2JXhsF4sp1xQrZq7YT0ysWAhByvuHrZTDnjScTCVWLm0@90CaK@JcBuI6wwDOwbgVywghJS4FEDd/ktsocW4YaFFRSr8B "Perl 5 – Try It Online") - Perl  
[Try it online!](https://tio.run/##bVLvT9swEP3OX3FEm2qnxaRoP6SZqNqmIU0a2wQf2yK5idMaHCezHWpg/O3dOc3YkIgU2Xf3/M7v@a7FrTi6Lm92qm4b6@EaY6YalnL4P9N5pV/MWbmWASsHbbfSqoBCC@fgXCgDDzDknBcel9tGlVBjhVx6q8wahF27@ZKC39hm6@BLKGTrVYMnDwDOlJZQ5UZu@y1JWNGUkmE9ofxTV1XSyvJCilJaWPWw50ny9@QQVpTyoa@beL7dRH5CXL5CDaL8powklB7mptOaqoo4Jn91QjuSHKdpmlD68By6ZyDEv0jwgAz@iQEJjpFhhbgb7sb5aGFGcfX8cZ97/Cm8l9aAzYcdqq3b2MBRjm6smkZLYeA@r5BRcrgshDEoXZm285BDVDvkyOWd87JmylAOg84exjbCfZfB4zV7iwEGQzTeHTn2IIOIQeJQny9BYzmimGu18iQ5wkdAvAeTYeWr8TgGlrXCOokB0fNsSSdgpi8WmZZm7TenJzCDiIQPuEyXyFhshJ0vw6Cnj8x0yeGjteLOsUppTcJkFEa9KQBVY6M2vEZuMg7mNDdTXMZjFHgufLFBh2pks6zeR6SfXIMD/hnJ9xPDtla0ZGhRNO3dj@pCmLXETtnEUBqVVkBqbG9K9C6@7T0dTG7Qsa1VXpL4qJTf59528X3@lVv00Fckee0StITyx/gdxKnaXZFZTvp/8Taks99XlMwOSQhjungzfkVpCDRWFye4pSkJKaWLd0@Q9wgJYRena5cdTbMs@wM "Java (JDK) – Try It Online") - Java  
[Try it online!](https://tio.run/##XVBNa@MwEL33V0yFwDOJk9ghbQmK8WW7UCg97PYWt8J1ldqsIwtZBUG3vz0dh7KHPcwwH@@9@XCtO@1K1zqQHgoQKwFLcN68aW9cXzcGk9VyVmrd1n3QzXB0XW98hRWp6tdqTFJI2A5c1G9mAthgbBhR659397daUwo5sSQLK@hsp0cTULjGm@VL3fwJnp3uu2MXRApis95uttc36@2VIHVxGDzKrsiU7IsDq4/4@/HH3QMp@oDugLLfj8H3xnJEi/ypKERlBTF4fH/hDpfTLF3kNPFNdP3walAsRMpwxfxmeLdh4u7WTNqzAPvsSV0AnCfb71zaXXHuczSfE48GPH/oWIemRelTHja9y9QBk5ik0hIRfEwrdmSadpj2UsCn5AqmHKRVn5///RRJnZ6xLPBs1VWclX@fCctLjHFO1WYuiWKkqVutOaQZxhlRdf0PcsOQGE@nbJFnWfYF "PHP – Try It Online") - PCRE  
[Try it online!](https://tio.run/##PY/daoQwEIXvfYpp6EVGoyTbdgva4IOoC0s3rinZKEkKWei7W2N/LgYO851zhlnuYZrt06pvy@wC@LtnTl1VZB9@tg046Qgh64m2ku7Tv8S8/TohbR9ojAX2z8UjYoyYaH/YJOY05oj98d/yulliXLeiTtSlGBrQkmfj7MCAtulm5cNF2zoDI03lF6MDJSXBDPQIRllq8O1Qg@nEIE3HhwxS2KawO9urotoGmgCyHyUGLARufalg/6fy6uzeJ@oYkEhyu8NEdQ2LS6nRfPpJCtz3UjS/ax8ctciUvUhC2J9p5aXgnH8D "Python 3 – Try It Online") - Python `import regex`  
[Try it online!](https://tio.run/##PY7BasMwDIbvewo1DGqlxDih6w6eCYXuusPYLWnNSt3UYNzguNSDsVfP7LDlICH9@j9J7nb8Gh0IeFedCj216g677ceWOvV54qAF43C/aKPAiE754QFAn8E0RbkXImttxuPANIzSotpzUPYUHVGhQ2@0J8tiiX8INcp2/kLwpYpME/mIzcj56sCCtpBE6q9Sk5Ihpck4t9E37SJZyHKLIH7A8SToRfqzv/lh2pf@LmPvtPVg/0@knELK17edlOOB1IJM0T6FvP4@IKkXJIQVtuvVI2IImKZtFUvMScgR281seY6WEMaRFSVj7Bc "Ruby – Try It Online") - Ruby  
[Try it online!](https://tio.run/##RZDdaoQwEIVfxcqAGW2WuPQHVoILve4TqAviZmsgTSRmMaz12W3c0vZiYM6Zj8NhBjMJO/ZCqRUsr6z4EL45HLSYyDFZT6Tk5D71s0/LrxOS8oF4n2H9lAGi97hd631YMSU@Raxf/pDXgHi/JsfH@M18DlKJc4wF3DgrLsaKtusJqEjqCKQerg5naDkoOg5KupjGhbwQaHeduWpHlYv2G5BxaCvWLCGAgOaV1K65OwVoqsSvzjedZThvGXb33rquFyNJfJKCxh/7hvNkpRO0N6NbQq28@NcR1SY8QUktItDLsqyM5oyxbw "PowerShell – Try It Online") - .NET
To be portable to all 6 regex engines, this uses neither nested backreferences nor subroutine calls.
[Answer]
# [Python 3](https://docs.python.org/3/), ~~104~~ ~~97~~ 93 bytes
```
p=lambda m:(m>1)*all(m%x for x in range(2,m))
f=lambda n:p(n)*p(len([*filter(p,range(n+1))]))
```
Returns `0`/`1`, at most 4 bytes longer if it has to be `True`/`False`.
[Try it online!](https://tio.run/##PYzBCsIwEETv/YqlIOy2ezDW0jagPyIeIjZaSLYh5lC/PgZEBwaGx8yEd3qu0uUcTs74292A1@jPihrjHPrdBnaNsMEiEI08ZjywJ6rsry06oFAT0M2Cl8YuLs0RA3/L0iqiK1H@n5Q9dAxHhp5hYFCquABV8rCfGMa@kGlSpCsoCnGRhK8UcaO21jWDLYnyBw "Python 3 – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), 79 bytes
```
n=input()
s={2};p=i=1
while i<n:
 p*=i;i+=1
 if p*p%i:s|={i}
print{n,len(s)}<=s
```
[Try it online!](https://tio.run/##DchBCoAgEAXQvadwE2S10U1QzXEMP8g0pBFhnt1avidPDge71pjAcuXeqETF1VUIZNUdEL3GxovSMhBWjP9q7L@kw5JeKqhKTnAuPEXPfTJ1o9SanT8 "Python 2 – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 7 bytes
```
ÆCÆPaÆP
```
[Try it online!](https://tio.run/##y0rNyan8//9wm/PhtoBEIP7//7@lpSEA "Jelly – Try It Online")
`ÆC` counts the number of primes less than or equal to the input (so, if the input is the *n*th prime, it returns *n*). Then `ÆP` tests this index for primality. Finally, `a` does a logical AND between this result and `ÆP` (primality test) of the original input.
[Answer]
# [Haskell](https://www.haskell.org/), 62 bytes
```
p x=2==sum[1|0<-mod x<$>[1..x]]
f x=p$sum[1|y<-[1..x],p y,p x]
```
[Try it online!](https://tio.run/##ZcmxCoMwFEbh3af4h4xX8WolDSR9kZAhYKVSo6G2EMF3j4Jjh7Oc7@XX93Oaco5IpjFm/QXLe63LsPRIWjwsV1VyrhhOj@LiTZfXpojtLLkc/DjDoF8KIH7G@QuB4CMG2IZuJIlbunfs/rmljpiJJclakVLs8gE "Haskell – Try It Online") Usage: `f 991` yields `True`. 
[Answer]
# [Husk](https://github.com/barbuz/Husk), 2 bytes
```
ṗṗ
```
[Try it online!](https://tio.run/##yygtzv7//@HO6UD0//9/cwA "Husk – Try It Online")
One of the cases when the behaviours of functions returning non booleans is really helpful.
user's solution.
# [Husk](https://github.com/barbuz/Husk), 4 bytes
```
ṗ£İp
```
[Try it online!](https://tio.run/##yygtzv7//@HO6YcWH9lQ8P//f1MA "Husk – Try It Online") or [Verify all test cases](https://tio.run/##yygtzv6f@6ip8f/DndMPLT6yoeD////RRjrGOiY6pjrmOoaGOobGOobmOuYGljoWpoY6lpaGsQA "Husk – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 6 bytes
```
ÝØ<Øså
```
[Try it online!](https://tio.run/##MzBNTDJM/f//8NzDM2wOzyg@vPT/f0NDAA "05AB1E – Try It Online")
### Explanation
```
ÝØ<Øså
Ý      # Push range from 0 to input
 Ø     # Push nth prime number (vectorized over the array)
  <    # Decrement each element by one (vectorized)
   Ø   # Push nth prime number again
    s  # swap top items of stack (gets input)
     å # Is the input in the list?
```
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 12 bytes
```
&P_QP_smP_dS
```
[Try it online!](https://tio.run/##K6gsyfj/Xy0gPjAgvjg3ID4l@P9/Q0MA "Pyth – Try It Online")
### Explanation
```
&P_QP_smP_dS
                Implicit input
       mP_dS    Primality of all numbers from 1 to N
      s         Sum of terms (equal to number of primes ≤ N)
    P_          Are both that number
&P_Q            and N prime?
```
[Answer]
# Mathematica, ~~35~~ 29 bytes
```
P=Prime;!P@P@Range@#~FreeQ~#&
```
*-6 bytes from @MartinEnder*
[Answer]
## Pyke, 8 bytes
```
sI~p>@hs
```
[Try it here!](http://pyke.catbus.co.uk/?code=sI%7Ep%3E%40hs&input=5&warnings=0)
```
s        -  is_prime(input)
 I~p>@hs - if ^:
  ~p>    -    first_n_primes(input)
     @   -    ^.index(input)
      h  -   ^+1
       s -  is_prime(^)
```
[Answer]
# [Python 2](https://docs.python.org/2/), 89 bytes
```
def a(n):
 r=[2];x=2
 while x<n:x+=1;r+=[x]*all(x%i for i in r)
 return{n,len(r)}<=set(r)
```
[Try it online!](https://tio.run/##TY2xCsIwEED3fMUtQmIdNKBD2/uSkCHg1R6EazkjRsRvj3Vze8N7vPVV5kV8a1eaIFlxvQHF4ONQ0Rt4zpwJ6ih97fA0aIehxn3K2dYdw7QoMLCAuq2i8lB5yyGTWHWfEe9UNmirshQI/3qSG9nL@eiAf1d20bQv "Python 2 – Try It Online")
Constructs `r`, the list of primes <= n; if n is prime, then `n` is the `len(r)`'th prime. So n is a super prime iff n in r and len(r) in r.
[Answer]
# [Factor](https://factorcode.org/) + `math.primes`, ~~51~~ ~~49~~ ~~36~~ 32 bytes
Saved 13 bytes thanks to @Bubbler!
Saved 4 bytes thanks to @chunes!
```
[ dup nprimes index ?1+ prime? ]
```
[Try it online!](https://tio.run/##NYyxCsIwFEV3v@LuQvBZS60OHcXFRZzEIaSvWkxfY5KCIn57lKrL4XK4nEab2Pt02G93mxWu7IUtnOcYH863EhH4NrAYDrC90Tag0/EyQn0OHX@F8lrO/90MYmLbS8B68gRhjgwL5ChABMpABYpZiWVOKEvCKx1RDw7y67VS8x0VTTGKCqfUaQeV3g "Factor – Try It Online")
```
[ dup nprimes index ?1+ prime? ]
  dup nprimes                    ! First n primes (generates extra primes)
              index              ! Find the index of the input in that
                                 ! when the index is not found, an f is outputted
                                 ! If the index exists,
                    ?1+          ! If it's a number, increment
                                 ! If it's f, output 0 (which is not prime)
                        prime?   ! Is that prime?
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) `g`, 4 bytes
```
¡†"æ
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJBZyIsIiIsIsKh4oCgXCLDpiIsIiIsIjJcbjNcbjRcbjVcbjdcbjExXG4xM1xuMTdcbjcwOVxuODUxXG45OTEiXQ==) - test cases only
This is the same as the 5 byte answer below except the minimum is taken by the `g` flag rather than a `g` element.
# [Vyxal](https://github.com/Vyxal/Vyxal), 5 bytes
```
¡†"æg
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCLKgChuzrsiLCLCoeKAoFwiw6ZnIiwiO+KAoFtuLF0pIiwiMTUwMCJd)  
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJBIiwiIiwiwqHigKBcIsOmZyIsIiIsIjJcbjNcbjRcbjVcbjdcbjExXG4xM1xuMTdcbjcwOVxuODUxXG45OTEiXQ==) - test cases only
This makes use of [Prime counting function](https://codegolf.stackexchange.com/questions/94348/prime-counting-function/250044#250044), based on [Dennis's 05AB1E solution](https://codegolf.stackexchange.com/a/94364/17216) to that challenge. This is actually much faster than the other two 5 byte solutions presented below it.
```
¡  # Factorial
†  # Number of distinct prime factors – when applied to the factorial, this
   # gives the index of the greatest prime ≤ the input number (1-indexed).
"  # Wrap the top two items (the input number, and the above result) in a list.
æ  # Is the number prime? (Vectorized)
g  # Minimum - effectively applies a boolean AND to the list
```
---
Alternative 5 bytes:
```
Þpḟ›æ
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCLKgChuzrsiLCLDnnDhuJ/igLrDpiIsIjvigKBbbixdKSIsIjEwMDAiXQ==)  
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJBIiwiIiwiw55w4bif4oC6w6YiLCIiLCIyXG4zXG40XG41XG43XG4xMVxuMTNcbjE3XG43MDlcbjg1MVxuOTkxIl0=) - test cases only
```
Þp  # An infinite list of primes
ḟ   # Index of input number in that list (0-indexed; -1 if not found)
›   # Add 1
æ   # Is the number prime?
```
---
Another alternative 5 bytes:
```
Þp‹ǎc
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCLKgChuzrsiLCLDnnDigLnHjmMiLCI74oCgW24sXSkiLCIxMDAwIl0=)  
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJBIiwiIiwiw55w4oC5x45jIiwiIiwiMlxuM1xuNFxuNVxuN1xuMTFcbjEzXG4xN1xuNzA5XG44NTFcbjk5MSJd) - test cases only
Port of [Datboi's 05AB1E solution](https://codegolf.stackexchange.com/a/130398/17216). This is much slower than the primary 5 byte solution above, but much faster than its 05AB1E counterpart.
```
Þp # An infinite list of primes
‹  # Subtract 1 from every item on the list
ǎ  # Nth prime - vectorized to the entire list
c  # Contains - Is the input number a member of that list?
```
[Answer]
# [Thunno](https://github.com/Thunno/Thunno) `D`, \$ 8 \log\_{256}(96) \approx \$ 6.58 bytes
```
FAFLZPNP
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72sJKM0Ly9_abSSi1LsgqWlJWm6FivcHN18ogL8AiBcqOiCRYaGEBYA)
Port of Deadcode's Vyxal answer.
It's all uppercase letters!
#### Explanation
```
FAFLZPNP  # Implicit input
F         # Factorial
 AF       # Unique prime factors
   L      # Length
    ZP    # Pair
      N   # Is prime
       P  # Product
          # Implicit output
```
[Answer]
# [Raku](https://raku.org/), ~~46~~ 35 bytes
~~`{$/=&is-prime;all($_∈*,$/)([grep $/,1..$_])}`~~
```
grep {.is-prime&&is-prime ++$},^∞
```
[Try it online!](https://tio.run/##K0gtyjH7n1up4FCsYPs/vSi1QKFaL7NYt6AoMzdVTQ3GUtDWVqnViXvUMe@/tUJxIkh5dJyhaex/AA "Perl 6 – Try It Online")
Six years of golfing experience let me cut down on this solution considerably.
[Answer]
# [QBIC](https://drive.google.com/drive/folders/0B0R1Jgqp8Gg4cVJCZkRkdEthZDQ), 33 bytes
```
~µ:||\_x0]{p=p-µq|~q=a|_xµp]q=q+1
```
## Explanation
```
~   |   IF   ....  THEN (do nothing)
  :         the number 'a' (read from cmd line) 
 µ |        is Prime
\_x0        ELSE (non-primes) quit, printing 0
]           END IF
{           DO
            In this next bit, q is raised by 1 every loop, and tested for primality. 
            p keeps track of how may primes we've seen (but does so negatively)
    µq|     test q for primality (-1 if so, 0 if not)
p=p-        and subtract that result from p (at the start of QBIC: q = 1, p = 0)
~q=a|       IF q == a
_xµp        QUIT, and print the prime-test over p (note that -3 is as prime as 3 is)
]           END IF
q=q+1       Reaise q and run again.
```
[Answer]
## Haskell, 121 bytes
```
f=filter
p x=2==(length$f(\a->mod(x)a==0)[1..x])
s=map(\(_,x)->x)$f(\(x,_)->p x)$zip[1..]$f(p)[2..]
r x=x`elem`(take x s)
```
[Answer]
# [Positron](https://github.com/alexander-liao/positron), 148 bytes
```
x=#(input@@)a=function{p=1;k=$1==2;f=2;while(f<$1)do{p=p*$1%f;k=1;f=f+1};return p*k}r=1;i=2;while(i<x)do{if(a@i)then{r=r+1}i=i+1}print@((a@x*a@r)>0)
```
[Try it online!](https://tio.run/##PYvBDsIgEER/xURMoF5Ej3QNv0IU0k3NQlaIJE2/HdeLh5nDvHklv7FypjE6HDVSadV7EyA1elTMtBWwbgVlAa4uST4LvqJOs7LmmYWWSdlTkosVnM52dxxrYzqUad1ZVvxLOPefg0kHj6YukTYGFgUBpQsjVa8F9il4NveLGeP2BQ "Positron – Try It Online")
[Answer]
# [Pari/GP](http://pari.math.u-bordeaux.fr/), 31 bytes
```
n->(p=isprime)(n)*p(primepi(n))
```
[Try it online!](https://tio.run/##K0gsytRNL/ifZvs/T9dOo8A2s7igKDM3VVMjT1OrQAPMLsgEcjT/p@UXaeQp2CoY6igYGhjoKADl8kqAIkoKunZAIg2kSPM/AA "Pari/GP – Try It Online")
[Answer]
# Matlab, ~~36~~ 34 bytes
*Saved 2 bytes thanks to Tom Carpenter.*
A very naive implementation using built-in functions:
```
isprime(x)&isprime(nzz(primes(x)))
```
[Answer]
# Julia 0.6, 61 bytes
return 1 if x is a super-prime, 0 otherwise.
without using an isprime-kind function.
```
x->a=[0,1];for i=3:x push!(a,0∉i%(2:i-1))end;a[sum(a)]&a[x]
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 11 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
ÒÈj}jU bU)j
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=0shqfWpVIGJVKWo&input=OTkx)
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 9 bytes
```
P_hx.fP_Z
```
[Test suite](http://pythtemp.herokuapp.com/?code=P_hx.fP_Z&test_suite=1&test_suite_input=2%0A3%0A4%0A5%0A7%0A11%0A13%0A17%0A709%0A851%0A991&debug=0)
Uses a fairly different approach to the existing Pyth solution. Returns `True` for super-primes, `False` for non-super-primes, and `[]` (falsy) for composite numbers.
[Answer]
# [Ruby](https://www.ruby-lang.org/), 72 bytes
Tired of all the extremely obscure golfing languages in this thread? Here's the practical language solution you're looking for! Let me know if you see a way to shave off a few bytes.
```
require'prime';n=gets.to_i;p n.prime?&&(Prime.take(n).index(n)+1).prime?
```
[Try it online!](https://tio.run/##KypNqvz/vyi1sDSzKFW9oCgzN1XdOs82PbWkWK8kPz7TukAhTw8sbK@mphEAYuiVJGanauRp6mXmpaRWABnahppQJf//W1oaAgA "Ruby – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 6 bytes
```
.Ø>‚pß
```
[Try it online!](https://tio.run/##yy9OTMpM/W9QbOfm4vJf7/AMu0cNswoOz/@feWifoUOmkpJOrYv9oT21drX/DU0NDAA "05AB1E – Try It Online") - 05AB1E  
[Try it online!](https://tio.run/##yy9OTMpM/X9uq8t/vcMz7B41zCo4PP///2gjHQVjHQUTHQVTHQVzHUNDHUNjHUNzHXMDSx0LU0MdS0vDWAA "05AB1E – Try It Online") - 05AB1E - test cases only  
[Try it online!](https://tio.run/##MzBNTDJM/X9uq8t/vcMz7B41zCo4PP///2gjHQVjHQUTHQVTHQVzHUNDHUNjHUNzHXMDSx0LU0MdS0vDWAA "05AB1E (legacy) – Try It Online") - 05AB1E (legacy) - test cases only
Equal in length to [Datboi's solution](https://codegolf.stackexchange.com/a/130398/17216), but much faster on numbers that are not super-prime.
```
.Ø  # Get 0-indexed number of the greatest prime ≤ input number
>   # Add 1
‚   # Wrap the top two items (the input number, and the above result) in a list
p   # Is the number prime? (Vectorized)
ß   # Minimum - effectively applies a boolean AND to the list
```
---
Alternative 6 bytes:
```
!fg‚pß
```
[Try it online!](https://tio.run/##yy9OTMpM/W9QbOfm4vJfMS39UcOsgsPz/2ce2mfokKmkpFPrYn9oT61d7X9DAwMDAA "05AB1E – Try It Online")  
[Try it online!](https://tio.run/##yy9OTMpM/X9uq8t/xbT0Rw2zCg7P//8/2khHwVhHwURHwVRHwVzH0FDH0FjH0FzH3MBSx8LUUMfS0jAWAA "05AB1E – Try It Online") - test cases only
This makes use of [Dennis's Prime counting function solution](https://codegolf.stackexchange.com/a/94364/17216), which is equal in length to (but slower than) the ones using built-in prime-counting functions.
[Answer]
# [C89 (clang)](http://clang.llvm.org/), 92 bytes
```
#define s for(i=e;--i&&e%i;)p+=i <3
p,r,i;m(e){s;for(p=r=i==e%2;--e;)s;e=p+1;s;return r<i<r;}
```
*(added whitespace for readability)*
### Some alternatives:
* `i==e%2` \$\equiv\$ `i==1&e`
* `r<i<r` \$\equiv\$ `1<i<r` \$\equiv\$ `i<2&r` \$\equiv\$ `i/2<r` \$\equiv\$ `i<r+r` \$\equiv\$ `i<2*r`
[Try it online!](https://tio.run/##FY3NasMwEITP1lMsCQ4Stkt@Li0r9V2MtEoX7LWQnF5CXr2qchuG75vxk19mudd6DBRZCArELWt2hNPEpxP1jCYNju1NpTGPjKsm8yz4ppLLjp2j/tpgQlOQXBouWDDT/sgC2bLN@KpHFr88AoEte@Dt4@dbKZZdrTOL/t04GPVUXWtAUKmubYMWcHBBELBwPZ8RhkGM6jqOoFct5p27lJsT9aEPcBhBDKpX/fNxme@lTu3K@c@vfw "C (clang) – Try It Online")
]