text:
Triple-balanced numbers
Description
We consider an integer with at least 3 digits triple-balanced if, when split into three parts, the digits in every part sum up to the same number. We split numbers as follows:
abcdefghi - Standard case: the number of digits is divisable through 3:
abc def ghi

abcdefgh - Number % 3 == 2: The outer groups are both assigned another digit
abc de fgh (the inner group will have one digit less than both outer groups)

abcdefghij - Number % 3 == 1: The inner group is assigned the extra digit
abc defg hij (the inner group will have one digit more than the outer groups)

Challenge
Your task is to write a program, that, given an integer with at least 3 digits, determines whether the given number is triple-balanced and outputs a truthy or falsy value based on it's result.
Test cases
333 -> True
343 -> False
3123 -> True
34725 -> True
456456 -> False
123222321 -> True

This is code-golf, so standard loopholes apply and may the shortest answer in bytes win!

As I understand it, if you can split it evenly, you should.

@Mr.Xcoder you split it into three parts (it still doesn't work as per @MagicOctopusUnr's comment: when split in three parts,

@geokavel But then you're violating when split in three parts,

Consider using the Sandbox, to avoid such a situation in the future.

Whoops! I'm sorry for the confusion about the test cases, apparently I had some sort of twist in my head. Now that they are corrected, I hope you vote to reopen my challenge.

By default, input is allowed to be taken as a string. Can it be taken as an array of digits?

Python 2, 93 88 86 bytes
-4 bytes thanks to @LeakyNun
-2 bytes thanks to @Mr.Xcoder
def g(i):l=-~len(i)/3;print f(i[:l])==f(i[l:-l])==f(i[-l:])
f=lambda a:sum(map(int,a))

Try it online!

Jelly, 23 bytes
DµL‘:3‘Ṭ©œṗ⁸U®œṗÐ€S€€FE

Try it online!
There must be a shorter way that somehow flew over my head...

It seems straight-forward but it really isn't tbh... Even difficult in 05AB1E due to the non-default splitting.

Retina, 89 bytes
^|$
¶
{`¶(.)(.*)(.)¶
$1¶$2¶$3
}`^((.)*.)(.)¶((?<-2>.)*)¶(.)
$1¶$3$4$5¶
\d
$*
^(1+)¶\1¶\1$

Try it online! Link includes test cases. Explanation: The first stage adds newlines at the start and end of the input. The second stage then tries to move digits across the newlines in pairs, however if there aren't enough digits left in the middle then the third stage is able to move them back, causing the loop to stop. The fourth stage then converts each digit separately to unary thus summing them, while the last stage simply checks that the sums are equal.

Jelly, 20 bytes
DµL‘:3x2jSạ¥¥LRṁ@ḅ1E

Try it online!
How it works
DµL‘:3x2jSạ¥¥LRṁ@ḅ1E  Main link. Argument: n

D                     Decimal; convert n to base 10, yielding a digits array A.
 µ                    Begin a new chain with argument A.
  L                   Compute the length of A.
   ‘                  Increment; add 1 to the length.
    :3                Divide the result by 3.
                      This yields the lengths of the outer chunks.
      x2              Repeat the result twice, creating an array C.
             L        Compute l, the length of A.
            ¥         Combine the two links to the left into a dyadic chain.
                      This chain will be called with arguments C and l.
           ¥              Combine the two links to the left into a dyadic chain.
         S                    Take the sum of C.
          ạ                   Compute the absolute difference of the sum and l.
        j                 Join C, using the result to the right as separator.
                      We now have an array of the lengths of all three chunks the
                      digits of n have to be split in.
              R       Range; map each chunk length k to [1, ..., k].
               ṁ@     Mold swapped; takes the elements of A and give them the shape
                      of the array to the right, splitting A into chunks of the
                      computed lengths.
                 ḅ1   Convert each chunk from unary to integer, computing the sum
                      of its elements.
                   E  Test if the resulting sums are all equal.

I'd love to read an explanation

@FelixDombek I've added an explanation.

Mathematica, 142 bytes
(s=IntegerDigits@#;c=Floor;If[Mod[t=Length@s,3]==2,a=-1;c=Ceiling,a=Mod[t,3]];Length@Union[Tr/@FoldPairList[TakeDrop,s,{z=c[t/3],z+a,z}]]==1)&

Javascript, 178 bytes
(a)=>{b=a.split(/(\d)/).filter((v)=>v);s=Math.round(b.length/3);f=(m,v)=>m+parseInt(v);y=b.slice(s,-s).reduce(f,0);return b.slice(0,s).reduce(f,0)==y&&y==b.slice(-s).reduce(f,0)}

Welcome to PPCG! Have you read the tips pages? There's a lot of scope for golfing your answer down.

In case you're still interested, I was able to trim your answer down to 106 bytes: ([...b],s=~b.length/3|0,f=(m,v)=>+m+ +v,y=b.splice(s).reduce(f))=>b.splice(-s).reduce(f)==y&y==b.reduce(f) (take care when copying from comments as Stack Exchange inserts invisible characters).

Beautyful! Many things for me to learn in there.

MATL, 26 bytes
3:jnZ^!S!tgtYswG48-*Z?da~a

Try it online! Or verify all test cases.

Java 8, 149 143 140 138 137 bytes
q->{int l=q.length,s=-~l/3,a=0,b=0,c=0,i=0;for(;i<s;)a+=q[i++];for(s=l/3*2-~-l%3/2;i<=s;)b+=q[i++];for(;i<l;)c+=q[i++];return a==b&b==c;}

-9 bytes thanks to @ceilingcat.
Takes the input as an int[].
Explanation:
Try it here.
q->{                 // Method with int-array parameter and boolean return-type
  int l=q.length,    //  Length of the input-array
      s=-~l/3,       //  (Length + 1) divided by 3
      a=0,b=0,c=0,   //  Three sums starting at 0
      i=0;           //  Index-integer
  for(;i<s;)         //  Loop `i` in the range [0, `s1`):
    a+=q[i++];       //   Increase `a` by every `i`'th digit of the input-array
  for(s=l/3*2-~-l%3/2;i<=s;)
                     //  Loop `i` in the range [`s1`, `s2`):
    b+=q[i++];       //   Increase `b` by every `i`'th digit of the input-array
  for(;i<l;)         //  Loop `i` in the range [`s2`, length):
    c+=q[i++];       //   Increase `c` by every `i`'th digit of the input-array
  return a==b&b==c;} //  Return whether `a`, `b` and `c` are all equal

Here is an overview of the 0-indexed \$[n,m)\$ parts for each length:
Length:  Parts:    0-indexed ranges:

 3       1,1,1     [0,1) & [1,1] & [2,3)
 4       1,2,1     [0,1) & [1,2] & [3,4)
 5       2,1,2     [0,2) & [2,2] & [3,5)
 6       2,2,2     [0,2) & [2,3] & [4,6)
 7       2,3,2     [0,2) & [2,4] & [5,7)
 8       3,2,3     [0,3) & [3,4] & [5,8)
 9       3,3,3     [0,3) & [3,5] & [6,9)
10       3,4,3     [0,3) & [3,6] & [7,10)
...

For a we loop from 0 to (length + 1) / 3) (this value is now stored in s);
For b we loop from s to and including length / 3 * 2 - ((length + 1) % 3 / 2), where ((length + 1) % 3 / 2 is 0 if the length is divisible by 3 and 1 if not (this value is now stored in s);
For c we loop from s to length.

JavaScript, 129, 104 bytes
([...n],l=n.length/3+.5|0,r=(b,e=b*-4,z=0)=>n.slice(b,e).map(x=>z-=x)&&z)=>r(0,l)==r(-l)&&r(l,-l)==r(-l)

The function r slices the string based on parameters b and e, and then sums the digits and returns the value.
In order to slice in the correct sizes, we divide the length by 3 and round the result.  Calling slice(0,result) gives us the first block, slice(result,-result) gives us the second, and slice(result) gives us the last.  Due to the way I am calling slice, I used slice(result,4*result) instead of the last one but it gives the same result.
Finally, I compare the results show the values are equal.
Edit: same principle, better golfing

Is it possible to change && to & in JavaScript? Both second-hand checks (&&z and &&y[1]==y[2]) doesn't seem to modify values, so if it is possible, it shouldn't affect the result from what I can see.

I will take a look.  & is a bit operation vs && being a logical one, so it will change the output to 1 or 0 instead of true or false, but that works great in this case.

Röda, 82 bytes
f s{n=((#s+1)//3)[s[:n],s[n:#s-n],s[#s-n:]]|[chars(_)|[ord(_)-48]|sum]|[_=_,_=_1]}

Try it online!
Explanation:
f s{ /* function declaration */
    n=((#s+1)//3)
    [s[:n],s[n:#s-n],s[#s-n:]]| /* split the string */
    [ /* for each of the three strings: */
        chars(_)|    /* push characters to the stream */
        [ord(_)-48]| /* convert characters to integers */
        sum          /* sum the integers, push the result to the stream */
    ]|
    [_=_,_=_1] /* take three values from the stream and compare equality */
}

05AB1E, 19 bytes
gUSŽU]₂вXèûSX3÷*£OË

Try it online or verify all test cases.
Explanation:
g                  # Get the length of the (implicit) input-integer
 U                 # Pop and store this length in variable `X`
S                  # Convert the (implicit) input-integer to a list of digits
 ŽU]               # Push compressed integer 7769
    ₂в             # Convert it to base-26 as list: [11,12,21]
      Xè           # Index the length `X` into it (modulair 0-based - i.e. lengths=3,6,..
                   # will index into 11; 4,7,.. into 12; and 5,8,.. into 21)
        û          # Palindromize this integer: 11→111; 12→121; 21→212
         S         # Convert it to a list of digits
          X        # Push length `X` again
           3÷      # Integer-divide it by 3
             *     # Multiply it to each digit in the triplet
              £    # Split input-list of digits into three parts of these sizes
               O   # Sum each inner part
                Ë  # And check if the three sums are all equal
                   # (after which the result is output implicitly)

See this 05AB1E tip of mine (sections How to compress large integers? and How to compress integer lists?) to understand why ŽU] is 7769 and ŽU]₂в is [11,12,21].

L=tn, 35 bytes
cα;Gi≥l/3ö&i≤(2*l/3-1)öGi≠l¤2MαΣA=c

Explanation:
cα;                                  - convert to digit list
   G                                 - Group to string (will be used to group the middle number)
    i≥l/3ö&i≤(2*l/3-1)ö              - The middle number is limited on its start & end index
                       Gi≠l¤2        - Group every item but the middle one
                             MαΣ     - Map to digit sum
                                A=c  - All sums equals to first sum of list

This returns a list, Only valid if empty list = falsy, and non-empty list = truthy
Note: The language is in progress and I did add stuff (specifically ≤ and ≥ operators) to code golf this. It's still competing though.

Husk, 16 15 bytes
ËΣCẊ-mi¡+/3L¹0d

Try it online!
Returns 4 for truthy and 0 for falsy.
Explanation
ËΣCẊ-mi¡+/3L¹0d   Input is a number, say n=34725.
           L¹     Length of n (number of digits): 5
         /3       Divide by 3 (gives a rational number): 5/3
       ¡+         Iterate addition of 5/3
             0    starting from 0: [0,5/3,10/3,5,20/3,25/3,10,..]
     mi           Round each to the nearest integer: [0,2,3,5,7,8,10,..]
   Ẋ-             Differences between adjacent elements: [2,1,2,2,1,2,..]
  C           d   Cut the digits of n to chunks of these lengths: [[3,4],[7],[2,5]]
Ë                 Are these lists equal by
 Σ                sum? (Returns 0 or length+1)

Japt -x, 19 bytes
Input is a string, output is an integer: 0 for false or >0 for true.
ã á3 Ë¬¥U«ÓDË¬xÃâ Ê

Try it
ã á3 Ë¬¥U«ÓDË¬xÃâ Ê     :Implicit input of string U
ã                       :Substrings
  á3                    :Permutations of length 3
     Ë                  :Map each D
      ¬                 :  Join
       ¥U               :  Equal to U?
         «              :  AND NOT
          Ó             :  Bitwise NOT of negation of
           DË           :    Map D
             ¬          :      Split
              x         :      Sum
               Ã        :    End map
                â       :    Deduplicate
                  Ê     :    Length
                        :Implicit output of sum of resulting array


text:
Is it a turtle prime?
As we all know, it's turtles all the way down. But is it primes all the way down too?
A number is considered a "turtle-prime" if it satisfies the following conditions:
1) It is prime.
2) It is possible to remove a single digit leaving a prime number.
3) Step 2 can be repeated until left with a single digit prime.

For example, 239 is a "turtle-prime", as it can be reduced to 23 then either 2 or 3, both of which are prime. It also can be reduced to 29 then 2. 151 is not a turtle prime, as it reduces to 15 (not prime), 51 (not prime), or 11. 11 is prime, but can only reduce to 1, which is not.
Given a positive integer, determine if it is a "turtle-prime". Your output can be in any form so long as it gives the same output for any truthy or falsey value.
Test cases:
input -> output
1     -> false
2     -> true
17    -> true
19    -> false
239   -> true
389   -> false

Scoring
This is code-golf, so the shortest answer in each language wins!

Related

@MagicOctopusUrn WOW

Actually related

Can we take input as a list of digits?

@totallyhuman  I don't see why not. Go for it!

Your conditions say that all single-digit primes are not turtle primes. Condition 2 fails: it is not possible to remove a digit and still leave a prime number, as removing the only digit leaves nothing.

Jelly, 16 bytes
DŒPḊṖLÐṀḌß€¬Ȧ<ÆP

Try it online!
How it works
DŒPḊṖLÐṀḌß€¬Ȧ<ÆP  Main link. Argument: n

D                 Decimal; convert n to base 10.
 ŒP               Powerset; get all sub-arrays of n's decimal digits.
   Ḋ              Dequeue; remove the first sub-array (empty array).
    Ṗ             Pop; remove the last sub-array (all of n's digits).
     LÐṀ          Maximal by length; keep those of the remaining subarrays that
                  have maximal length. This keep exactly those sub-arrays that have
                  one (and only one) digit removed. If n < 10, this yields an empty
                  array. Without Ḋ, it would yield [[]] instead.
        Ḍ         Undecimal; turn the generated digit arrays into integers.
         ß€       Recursively map the main link over the generated integers.
           ¬      Negate; map 1 to 0 and 0 to 1.
            Ȧ     Any and all; yield 0 if the array is empty (n < 10) or any of the
                  recursive calls returned 1 (mapped to 0). If all calls returned
                  0, this will yield 1.
              ÆP  Test n for primality, yielding 1 for primes, 0 otherwise.
             <    Test if the result to the left is less than the result to the
                  right. This is possible only if the left result is 0 (n < 10 or
                  removing a digit results in a turtle prime) and the right result
                  is 1 (n itself is prime).

More magic Jelly! Man, this stuff gets everywhere...

Haskell, 104 102 99 98 97 95 91 bytes
p x=product[2..x-1]^2`mod`x>0
f[]=1>0
f x|y<-zip[0..]x=or[f[snd b|b<-y,b/=a]|a<-y,p$read x]

Try it online!
Explanation
First we set up a primality test
p x=product[2..x-1]^2`mod`x>0

This uses Wilson's Theorem to determine the primality of an input.
We then declare a base case, which will assert that the empty string is truthy.
f[]=1>0

Now we define the actual function
f x|y<-zip[0..]x=or[f[snd b|b<-y,b/=a]|a<-y,p$read x]

We use a pattern guard to bind zip[0..]x to y, because we need to use it twice later.  We then assert the answer is
or[f[snd b|b<-y,b/=a]|a<-y,p$read x]

[[snd b|b<-y,b/=a]|a<-y] is all of the numbers that are a digit removed from our input.  So we are asserting that at least one of these numbers is truthy for f.  In order to ensure that composite numbers are falsy we add in prime$read x.  If the number is not prime the list will become empty and the any of a empty list is false.

−2 bytes: any f[[ ↦ or[f[

−4 bytes: [b|(i,b)<-y,i/=a]|(a,_)<-y ↦ [snd b|b<-y,b/=a]|a<-y

R, 124 122 120 113 95 93 106 105 bytes
 g=pryr::f(`if`(gmp::isprime(sum(x*10^((l<-sum(x|1)-1):0))),any(!l,sapply(0:l+1,function(z)g(x[-z]))),!1))

Which evaluates to the function:
function (x)
if (gmp::isprime(sum(x * 10^((l <- sum(x | 1) - 1):0)))) any(!l,
    sapply(0:l + 1, function(z) g(x[-z]))) else !1

Recursive solution. Takes input as a list of digits.
Has 2 logical statements:

Is x prime when concatenated?
Is any of the following TRUE:

Is the length of x nonzero? This is our final terminating condition.
Is f TRUE for any subset of x?

The first statement ensures we keep working with primes only. The second does the actual recursion.
Saved two bytes thanks to @Giuseppe.
I had to revert some of my golfs because of a bug, where I was testing with a previous function definition by accident.
R, 98 bytes, non-competing
Like I mentioned in the comments, I made a package. Since the challenge predates that, this is non-competing, but I wanted to showcase it a bit. It's not much so far, but we'll get there.
g=pryr::f(`if`(gmp::isprime(RG::C(x)),any(!(l<-sum(x|1)-1),sapply(0:l+1,function(z)g(x[-z]))),!1))

C() is the first function in the package, and takes care of concatenating digits into a numeric.

Some of these operations (Looking at you sum(x*10^(((l<-sum(x|1))-1):0))) are sooo damned wordy. I am really considering creating a golf package for R.

this would have been my solution but I couldn't wrap my head around the sapply... Also I think you may want to do f=pryr::f(...) or else you need to use f in the sapply.

package name: golfR: somehow longer than the original language name

Oh and the exponents can be sum(x*10^((l<-sum(x|1)):1-1)) which is two bytes shorter.

Woops, I changed the function name to g to avoid confusion with pryr::f, but forgot the change that in the body...

@Giuseppe Single letter names for everything :D Why not call the package g or something?

@JarkoDubbeldam, R packages need to be at least two letters long.

I didn't know that. Two it is! Thinking of adding a feature that every function in the package automatically calls library so the package needs only be referenced once.

@Giuseppe Created the start for a package :p Take a look: https://github.com/JarkoDubbeldam/RG

@JarkoDubbeldam beautiful. I'm sure future challenges will make obvious what additional functions need to be added. String manipulation is big: something for el(strsplit(x,'')) would save a ton of bytes.

@BLT https://github.com/JarkoDubbeldam/RG/pull/2 on it :)

Jelly, 19 bytes
DJḟÐ€`ịDḌḟ0ß€¬Ȧ¬aÆP

Try it online!
How it works
DJḟÐ€`ịDḌḟ0ß€¬Ȧ¬aÆP                input:239

D                    decimal         [2,3,9]
 J                   range@length    [1,2,3]
  ḟÐ€`               filter out each [[2,3],[1,3],[1,2]]
      ịD             index&decimal   [[3,9],[2,9],[2,3]]
        Ḍ            undecimal       [39,29,23]
         ḟ0          filter out 0    [39,29,23]
           ß€        this@each       [1,1,1]
             ¬       logical not     [0,0,0]
              Ȧ      any and all     0
               ¬     logical not     1
                aÆP  and&is_prime    1

Recursion without base case ftw.

Jelly, 27 26 bytes
DµœcL’$Ḍµ€FÆPÐf
×⁵WÇÐĿFṪ<8

A monadic link taking and returning integers (1 for turtle 0 otherwise).
Try it online!
How?
DµœcL’$Ḍµ€FÆPÐf  Link 1: primes by digit removal: list of numbers  e.g. [19790]
D                cast to decimal list (vectorises)                      [[1,9,7,9,0]]
 µ      µ€       monadic chain for €ach:
      $            last two links as a monad:
    L                length                                             5
     ’               decrement                                          4
  œc             combinations without replacement                       [[1,9,7,9],[1,9,7,0],[1,9,9,0],[1,7,9,0],[9,7,9,0]]
       Ḍ         cast from decimal list (vectorises)                    [1979,1970,1990,1790,9790]
          F      flatten (from a list of lists form the for €ach to a single list)
             Ðf  filter keep if:
           ÆP      is prime?

×⁵WÇÐĿFṪ<8  Main Link: number, n             e.g. 1979
 ⁵          literal 10
×           multiply                              19790
              (this is so the first number is tested as prime too)
  W         wrap in a list                        [19790]
    ÐĿ      loop, collecting results (including the input×10) while change still occurs:
   Ç          call the last (1) link as a monad   [[19790],[1979],[197,199,179],[19,17,97,19,19,17,19,79],[7,7,7,7],[]]
      F     flatten                               [19790,1979,197,199,179,19,17,97,19,19,17,19,79,7,7,7,7]
       Ṫ    tail                                  7
        <8  less than 8?                          1
              (if a single digit prime was reached this will be 1
               otherwise it will be 0
               e.g. an input of 4 yields 40 at the end which is not <8)

It's interesting seeing two substantially different Jelly answers. Lets see who can cut theirs down smaller.

Python 2, 132 124 119 bytes
-8 Thanks to @WheatWizard
-5 Thanks to @LeakyNun
p=lambda i:i>1and all(i%v for v in range(2,i))
f=lambda n:n<'0'or any(f(n[:i]+n[i+1:])for i in range(len(n)))*p(int(n))

Try it online!
Can't think of anything to hone it down without some builtin prime checker.  Takes the number as a string (I assumed this given the OP allowed a list of digits, but if not then +14 bytes for another lambda), and recursively computes each "turtled" number's turtleness.

Shorter Primality test

I think f=lambda n,i=0:n==''or p(int(n))and i<len(n)and(f(n[:i]+n[i+1:])or f(n,i+1)) saves a byte. Someone with better Python golfing skills could probably shorten that further.

@Neil, it does save a byte, but the wording "the same output for any truthy or falsey value" prevents me from taking it, as inputting 1 returns 0 instead of False like the other cases (due to the -8 primality check).  If the OP allows different (although synonymous) outputs, then I would change it up.

Sorry, my previous suggestion is invalid. 119 bytes

Ruby, 72 57+8 = 80 65 bytes
Uses the -rprime flag. -15 bytes from histocrat!
f=->n{n==''||n.to_i.prime?&!n.scan(/./){f[$`+$']&&break}}

Try it online!

You can replace &&!! with just &, it will cast the result to a boolean. Your recursive call can also get a little shorter using perlisms: !n.scan(/./){f[$\+$']&&break}}`

@histocrat Ah yes, I forgot that I didn't actually need boolean short-circuiting for that last part due to the initial condition. Do you know why the n.scan trick works the way it does?

Yeah, the two global variables there are set to the string to the left and right of the most recent match, so concatenating them gives you the string minus the one character. Since we need state at each point in the iteration, we can't do anything like .scan.find, but we can manually break out of the loop on success. If we break, scan returns nil, otherwise it returns the string which is always truthy.

Java, 220 bytes
Try it online!
Golfed:
boolean t(String n){int l=n.length();if(f(x->{for(int i=2;i<x;)if(x%i++==0)return 1<0;return x>1;},new Integer(n)))if(l<2)return 1>0;else for(int i=0;i<l;)if(t(n.substring(0,i)+n.substring(++i,l)))return 1>0;return 1<0;}

Ungolfed:
  boolean t(String n) {
    int l = n.length();
    if (f(x -> {
      for (int i = 2; i < x;) {
        if (x % i++ == 0) {
          return 1 < 0;
        }
      }
      return x > 1;
    } , new Integer(n))) {
      if (l < 2) {
        return 1 > 0;
      }
      else {
        for (int i = 0; i < l;) {
          if (t(n.substring(0, i) + n.substring(++i, l))) {
            return 1 > 0;
          }
        }
      }
    }
    return 1 < 0;
  }

Ignore my previous comment. But you can golf it to this: boolean t(String n){int l=n.length(),x=new Integer(n),i;for(i=2;i<x;x=x%i++<1?0:x);if(x>1)if(l<2)return 1>0;else for(i=0;i<l;)if(t(n.substring(0,i)+n.substring(++i,l)))return 1>0;return 1<0;} (191 bytes)

You can save some bytes by returning 1 and 0 instead of true and false.

@Nevay That would work in C++, but not in Java. Integers cannot be implicitly converted to booleans.

Not sure but where does f come from?

The question states that any value may be used for true/false; the only place where you need a boolean result of the method is in the last if condition (where you can add >0 to convert the int to a boolean) which should save 22+14=8 bytes in Kevin Cruijssen's version.

05AB1E, 28 27 bytes
Iterative solution.
¸[D0èg2‹#εæ¨D€gZQÏDpÏ}˜]p1å

Try it online!
Explanation
¸                              # wrap input in a list
 [                             # start a loop
  D0èg2‹#                      # if the length of the first element is less than 2, break
         ε                     # apply to each element in the list
          æ                    # compute powerset
           ¨                   # remove last element (the full number)
            D€gZQÏ             # keep only the elements whose length is the max length
                  DpÏ          # keep only primes
                     }         # end apply
                      ˜        # flatten list
                       ]       # end loop
                        p1å    # is any element in the resulting list prime

C#, 355 bytes
namespace System{using B=Numerics.BigInteger;class A{static void Main(){Console.WriteLine(D(Console.ReadLine()));}static bool P(B x){if(x<2)return 1<0;B r=1;for(int i=1;i<=x-1;i++)r*=i;return(r+1)%x==0;}static bool D(string x){if(x.Length==0)return 1>0;bool b;if(b=P(B.Parse(x))){var n=1<0;for(int i=0;i<x.Length;i++)n|=D(x.Remove(i,1));b&=n;}return b;}}}

Try it online!
My first code golf, so I hope I did it alright. I couldn't think of a way to make it even smaller (other than using int instead of BigInteger, but I did it so it would work for all provided test cases). Anyway, here's the same properly formatted:
namespace System
{
    using B = Numerics.BigInteger;
    class A
    {
        static void Main()
        {
            Console.WriteLine(D(Console.ReadLine()));
        }

        static bool P(B x)
        {
            if (x < 2)
                return 1<0;
            B r = 1;
            for (int i = 1; i <= x - 1; i++)
                r *= i;
            return (r + 1) % x == 0;
        }

        static bool D(string x)
        {
            if (x.Length == 0)
                return 1>0;
            bool b;
            if (b = P(B.Parse(x)))
            {
                var n = 1<0;
                for (int i = 0; i < x.Length; i++)
                    n |= D(x.Remove(i, 1));
                b &= n;
            }
            return b;
        }
    }
}

Perl 6, 65 bytes
my&f={.is-prime&&(10>$_||?grep {f +[~] .list},m:ex/^(.*).(.*)$/)}

Try it online!

PHP, 164 bytes
function t($n){for($i=1;++$i<$n;)if($n%$i<1)return 0;if($n<10)return $n>1;foreach($r=str_split($n)as$k=>$v){$q=$r;array_splice($q,$k,1);$z|=t(join($q));}return $z;}

Try it online!
Starts off by testing the number for primality, then loops through the digits as an array, popping each one out and joining the rest back together and feeding them recursively through the function again. Each link downwards does a logical OR with the lower paths, only returning true if there exists at least one path of all primes.

Javascript 167 bytes
n=>{a=[];for(i=1;i++<=n;)a.every(x=>i%x)?a.push(i):0;b=k=>(s=''+k,a.indexOf(k)>-1&&(k<10||[...s].some((x,i)=>(r=[...s],r.splice(i,1),b(~~(r.join('')))))));return b(n)}

Explanation
n=>{
    a=[];                             // create array to store primes in
    for(i=1;i++<=n;)                  // iterate from 2 to n
        a.every(x=>i%x)?a.push(i):0;  // if i % x is truthy for all x in a,
                                      // then i is prime
    b=k=>(                            // function to test is k is turtle prime
        s=''+k,                       // convert k to a string
        a.indexOf(k)>-1 && (          // if k is prime and
            k<10 ||                   // k is a single digit or
            [...s].some((x,i)=>(      // iterate over the digits of k
                                      // and check to see if, by removing each
                                      // any of the resulting numbers is turtle prime
                                      // ... is spread operator
                                      // [...s] converts string s to an array of characters
                r=[...s],             // convert s to an array again,
                                      // importantly, this cannot be the same array
                                      // we created above, as we need to
                r.splice(i,1),        // splice out the ith element of the array
                b(~~(r.join('')))     // join the array to a string, convert to int,
                                      // and check if this number is turtle prime
                                      // ~ is bitwise negate, implicitly converts to int first before negating
                                      // ~~ negates the negation, getting us the int
            ))
        )
    );
    return b(n)
}

F=n=>{a=[];for(i=1;i++<=n;)a.every(x=>i%x)?a.push(i):0;b=k=>(s=''+k,a.indexOf(k)>-1&&(k<10||[...s].some((x,i)=>(r=[...s],r.splice(i,1),b(~~(r.join('')))))));return b(n)}

$('#input').on('keyup', () => $('#output').text(F(parseInt($('#input').val(), 10))))

<input type="text" id="input" />

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Can you loop without crashing?
Many of us are familiar with the game Tron. You control a "lightcycle" placed on a grid. The lightcycle always moves forward (though you control the direction) and leaves a permanent trail behind it. If you run into a trail, you crash!
The goal here is to determine if a given path is a valid loop, that is, it returns to its starting point without "crashing". To do this, we assume we start at the point (0,0). An input is given in the form N2E1S2W1, with a series of cardinal directions (N is north, E is east, and so on), each followed by the distance to travel that direction. In this example, you would travel
N2 : North 2 to (0,2)
E1 : East 1  to (1,2)
S2 : South 2 to (1,0)
W1 : West 1  to (0,0)

A path is considered valid if it ends at (0,0) without visiting any other coordinate more than once (it visits (0,0) exactly twice. Once at the start, and once at the end). Keep in mind than in the above example, to get from (0,0) to (0,2), we necessarily visit (0,1) as well.
Other examples:
input        -> output
N1E1S1W1     -> true
N1E1N1E1S2W2 -> true
N1S1E1W1     -> false     // Visits (0,0) 3 times
N4E2S2W4S2E2 -> false     // Visits (0,2) twice
N3E2S3       -> false     // Does not return to (0,0)
N1S1         -> anything  //I don't care how you evaluate this case

Your output can be in any form so long as it gives the same output for any truthy or falsey value.
The input can be taken as a string or as a list of characters, either in the form S1N2E3... or SNNEEE... There's is also no hard limit on the grid size, but assume the input isn't going to overflow anything. As long as the code is fundamentally sound, It's not crucial to handle cases like N99999999999999.
NOTE: You may evaluate the cases N1S1, E1W1, S1N1, and W1E1 however you would like. They're technically valid paths, but they go against the "Tron" spirit of the challenge.
Scoring
This is code-golf, so the shortest answer wins!

N1S1 should be true to be consistent with your definitions because it reaches (0, 0) twice and (0, 1) once, which is valid under your definition.

Can I take N as 1j, E as 1, S as -1j, and W as -1?

@LeakyNun I think I'm ok with that, since everyone should more or less be doing something like this the hood anyway. Just make sure you specify that in your answer.

@HyperNeutrino but from a Tron standpoint, your lightcycle goes through (0, 0.5) twice, even if the input will never put you at such a point. That's why I think that one has flexible output (even though for most languages it'll be easier to return true)

@ValueInk Okay, makes sense.

Will 0,0 be in a corner, ie are we guaranteed to only get positive coordinates? And is there a grid size limit, or is it infinite?

@steenbergh (0,0) is not in the corner, so you can go under or to the left of it; even both if you're feeling crazy! Also, there's no hard limit on the grid size, but just assume the input isn't going to overflow anything. As long as the code is fundamentally sound, I don't care if it can't handle inputs like N99999999999999

Is N1E1N1E1S1W1S1W1 valid?

@LeakyNun it is not. In a technical sense, you visit (1,1) twice. In a tron sense, our lightcycle has some width to it, so even though we only touch "corners", we'd still crash.

Pyth, 44 39 bytes
&!eJsM._smm^.j)x"NESW"hdstd:z".\d+"1{IJ

Test suite.

JavaScript, 247 200 bytes
n=s=>{r=s.match(/\w\d+/g)
x=y=z=0
e=""
for(d of r){a=d[0]
b=d.slice(1)
while(b--){
y+=a=="N"
y-=a=="S"
x+=a=="E"
x-=a=="W"
p=[x,y]+";"
if(~e.indexOf(p))if(!x&!y)z++
else return 0
e+=p}}return!x&!y&!z}

n is a function of input string s that returns 1 for true and 0 for false
Here's an ungolfed version for reference/explanation:
function n(s)
{
    var dir = s.match(/\w\d+/g);
    var x = y = z = 0;
    var been = "";
    for (d of dir)
    {
        var a = d[0];
        var b = 1*d.substring(1);
        while(b-- > 0)
        {
            if (a == "N") y++;
            if (a == "S") y--;
            if (a == "E") x++;
            if (a == "W") x--;
            var pt = [x,y] + ";";
            if (~been.indexOf(pt))
                if (x==0 && y==0)
                    z++;
                else
                    return false;
            been += pt;
        }
    }
    return (x == 0 && y==0 && z == 0);
}

n=s=>{r=s.match(/\w\d+/g)
x=y=z=0
e=""
for(d of r){a=d[0]
b=d.slice(1)
while(b--){
y+=a=="N"
y-=a=="S"
x+=a=="E"
x-=a=="W"
p=[x,y]+";"
if(~e.indexOf(p))if(!x&!y)z++
else return 0
e+=p}}return!x&!y&!z}

console.log(n("N1E1S1W1"))
console.log(n("N1E1N1E1S2W2"))
console.log(n("N1S1E1W1"))
console.log(n("N4E2S2W4S2E2"))
console.log(n("N3E2S3"))

Remove some whitespace

didn't notice that, thanks

It seems that contains isn't a function in any dialect of javascript. Could you specify the dialect?

I was just using the chrome console to test - it works perfectly there

Actually it works in my chrome console also... but maybe you would consider changing it into a more universal answer?

I changed it to ~e.indexOf(p) and that seems to work

Can x==0 etc. be changed to !x etc?

Yes, good catch

substring can become slice here, and the 1* seems unnecessary. Also, if(a=="N")y++ can be y+=a=="N" etc.

slice is a good suggestion, I'll change that. The 1* effectively casts the string into a number so I can use it in the while loop. I actually added the y+=a=="N" right before you commented

Doesn't the -- cast the string into a number anyway?

Ah yes, that does seem to work. I didn't realize you could do that. I will change it

I believe you could save a byte by storing points like x,y; instead of (x,y) in the string.

Change `(${x},${y})` to [x,y]+";" to save yourself 4 bytes.

Good suggestion, I changed it

Python 3, 236 161 150 bytes
import re
p=0
a=[]
for i in''.join(s[0]*int(s[1:])for s in re.findall(r".\d+",input())):p+=1j**"NESW".find(i);a+=[p]
print(len({*a})-len(a)==0==a[-1])

Try it online!
-75 bytes thanks to Leaky Nun
-11 bytes thanks to Leaky Nun
Or, if we're allowed to take input as a list of run length decoded complex numbers:
Python 2, 85 73 bytes
c=0;k=[]
for i in input():c+=i;k+=[c]
print(k[-1]==0==len(set(k))-len(k))

Try it online!
-12 bytes thanks to Mr. Xcoder / -9 bytes thanks to Leaky Nun (merged into one edit)
This feels too long to me lol

As long as it is shorter than 10 times the Pyth solution, it isn't too long.

@LeakyNun lol okay :P

161 bytes

@LeakyNun oh snap nice. see too long, as I said :P

76 bytes

157 bytes

154 bytes

79 bytes

73 bytes

150 bytes

Jelly, 14 12 bytes
Œṙ+\µQ⁼ȧṛ/¬$

This is my first time golfing in Jelly. Suggestions are welcome.
Input is as an array of [direction, distance] pairs, where the direction is given as a complex number.
Explanation:
Œṙ+\µÇȧṛ/¬$   Main link. Argument: n     = [[i, 3], [1, 2], [-i, 3]]
Œṙ            Run-length decode          = [i, i, i, 1, 1, -i, -i, -i]
  +\          Cumulative sum             = [i, 2i, 3i, 3i+1, 3i+2, 2i+2, i+2, i]
    µ         Begin a new monadic chain
     Q        Remove duplicates          = [i, 2i, 3i, 3i+1, 3i+2, 2i+2, i+2]
      ⁼       Equal to original?         = 0
           $  Make a monadic link:
        ṛ/      Reduce by right argument   = i
                (Gets the last element)
          ¬     Logical NOT:               = 0
       ȧ      Logical AND the two values = 0

Should fail the last case.

Retina, 86 bytes
\d+
$*
1(1*)
$1
+`(.)1
$1$1
.
 $`$&¶
%O`.
+`NS|E(.*)W
$1
M`\w$|(?m)(^.+$)(?s).+^\1$
^0

Try it online! Link includes test cases. Explanation:
\d+
$*

Convert the numbers to unary.
1(1*)
$1
+`(.)1
$1$1

Run-length decode the letters. N111 needs to turn into NNN, so one is subtracted from each unary number and then each 1 duplicates the previous letter.
.
 $`$&¶

Generate all the prefixes (i.e. points on the path) as separate lines. A space is prefixed to avoid issues with empty lines.
%O`.
+`NS|E(.*)W
$1

Sort all the letters in each line into order and then delete matching pairs. We end up with a unique code for any given point on the grid.
M`\w$|(?m)(^.+$)(?s).+^\1$

Check for one of two things: a) the last point doesn't end in a space (i.e. the loop didn't close), or two duplicate points in the path. If the path is valid, all checks fail and the result is zero.
^0

Invert the result.

Perl, 140
Works with string input. Perhaps I can shorten with array,but I doubt it.
Happy for any further golfing help :)
sub w{$i=$_[0];%d=(E,[0],S,[1,-1],W,[0,-1]);$i=~s/(.)(.)/($d,$o)=(@{$d{$1}},1,1);for(1..$2){$s[$d]+=$o;$r+=$d{"@s"}++}/eg;!($s[0]+$s[1]+$r)}

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/