[Question]
  [
A number is balanced if the sum of the digits on each half of the number is equal, so: `1423` is balanced because `1+4 = 2+3`, so is: `42615` because `4+2=1+5`. Note that the middle digit is not included on either side (or it's included on both sides) if there's an odd number of digits.
**Challenge:**
Take a positive integer as input, and output a truthy value if it's balanced and a falsy value if it's unbalanced.
**Test cases (true)**
```
1
6
11
141
1221
23281453796004414
523428121656666655655556655656502809745249552466339089702361716477983610754966885128041975406005088
```
**Test cases (false)**
```
10
12
110
15421
5234095123508321
6240911314399072459493765661191058613491863144152352262897351988250431140546660035648795316740212454
```
There will not be numbers starting with zero, for instance `00032` instead of `32`. You must support numbers up to at least 100 digits (so larger than `2^64-1`). As always, optional input format, so you may surround the number with apostrophes if desired.
  
[Answer]
# [05AB1E](http://github.com/Adriandmen/05AB1E), ~~14~~ 7 bytes
```
€D2äO`Q
```
**Explanation**
Using **141** as example:
```
€D       # duplicate each (turns the number into a list of digits)
         # STACK: ['1','1','4','4','1','1']
  2ä     # split list in 2 (as we duplicated each element, 
         # the middle element will exist on both sides for an odd length input
         # STACK: [['1','1','4'],['4','1','1']]
    O    # sum each sublist
         # STACK: [6,6]
     `   # flatten
         # STACK: 6, 6
      Q  # compare for equality
         # STACK: 1 (true)
```
[Try it online!](http://05ab1e.tryitonline.net/#code=4oKsRDLDpE9gUQ&input=NTIzNDI4MTIxNjU2NjY2NjU1NjU1NTU2NjU1NjU2NTAyODA5NzQ1MjQ5NTUyNDY2MzM5MDg5NzAyMzYxNzE2NDc3OTgzNjEwNzU0OTY2ODg1MTI4MDQxOTc1NDA2MDA1MDg4)
[Answer]
# [><>](https://esolangs.org/wiki/Fish), ~~31~~ 29 bytes
```
i:0(?v
~00}v>
v+r+>l4(?
>{=n;
```
[Try it online!](http://fish.tryitonline.net/#code=aTowKD92Cn4wMH12Pgp2K3IrPmw0KD8KPns9bjs&input=MjMyODE0NTM3OTYwMDQ0MTQ)
Line 1: Standard input loop
Line 2: Discard the -1 on top of the stack, push two 0's and rotate one to the bottom of the stack (this ensures that inputs of length <3 don't exhaust the stack later in the program)
Line 3: If the length of the stack is >3, add the top two and bottom two elements of the stack together.
Line 4: If top and bottom of the stack are equal, output 1, 0 otherwise.
*Edit: realised that there's no need to take the characters mod 12, 2 bytes saved*
[Answer]
# Haskell, ~~64~~ 63 bytes
```
b(a:t@(r:s))=a-last t+b(init t);b _=0
(==0).b.map fromEnum.show
```
One Byte Saved thanks to nimi
[Answer]
# [Brachylog](http://github.com/JCumin/Brachylog), 20 bytes
```
@eL@2tM,Lr@2t:M:+a#=
```
[Try it online!](http://brachylog.tryitonline.net/#code=QGVMQDJ0TSxMckAydDpNOithIz0&input=NTIzNDI4MTIxNjU2NjY2NjU1NjU1NTU2NjU1NjU2NTAyODA5NzQ1MjQ5NTUyNDY2MzM5MDg5NzAyMzYxNzE2NDc3OTgzNjEwNzU0OTY2ODg1MTI4MDQxOTc1NDA2MDA1MDg4)
### Explanation
```
@eL                    Get the list of digits L of the input
  L@2tM,               Get the second half M of L
        Lr@2t          Get the second half of the reverse of L
             :M        The list [L, M]
               :+a#=   The sum of elements of L and the sum of elements of M must be equal
```
[Answer]
## Mathematica, 57 bytes
```
Tr@(#-Reverse@#)[[;;⌊Length@#/2⌋]]==0&@*IntegerDigits
```
### Explanation
I was really hoping I could use this approach in some language, and it seems to be doing fairly well in Mathematica. The idea is to avoid having to obtain both the front and the back half by combining the list with its reverse and looking *only* at the front half.
```
...&@*IntegerDigits
```
First, we turn the input into a list of decimal digits and pass the result to the unnamed function on the left.
```
...(#-Reverse@#)...
```
Now we subtract the reverse of the list from the list itself. If the digits are `{a1,a2,...,an}` then the result will be `{a1-an,a2-an-1,...,an-a1}`.
```
...[[;;⌊Length@#/2⌋]]
```
We extract the first half of this list (excluding the middle digit although that doesn't actually matter, because the corresponding difference will be `0` anyway).
```
Tr@...
```
And then we sum this list. So that's:
```
a1 - an + a2 - an-1 + ... + a⌊n/2⌋ - a⌈n/2⌉+1
```
Rearranging:
```
a1 + a2 + ... + a⌊n/2⌋ - (a⌈n/2⌉+1 + ... + an-1 + an)
```
The input is balanced if the two halves have the same sum. Hence, this expression is zero if the input is balanced. So that's what we check:
```
...==0
```
[Answer]
# Java, 85 bytes
```
n->{int s=0,i=0,l=n.length();for(;i<l/2;)s+=n.charAt(i)-n.charAt(l-++i);return s==0;}
```
Note: the input is given as `String` as Java can't handle without `BigInteger` (and `BigInteger`s are constructed using a... `String`.)
## Testing and ungolfed:
```
import java.util.function.Predicate;
public class Main {
  public static void main(String[] args) {
    Predicate<String> f = n -> {
      int s = 0, i = 0, l = n.length();
      for (; i < l / 2;) {
        s += n.charAt(i) - n.charAt(l - ++i);
      }
      return s == 0;
    };
    String[] truthies = {"1",
      "6",
      "11",
      "141",
      "23281453796004414",
      "523428121656666655655556655656502809745249552466339089702361716477983610754966885128041975406005088"};
    for (String s : truthies) {
      boolean result = f.test(s);
      System.out.println(result);
    }
    String[] falsies = {"10",
      "12",
      "110",
      "15421",
      "5234095123508321",
      "6240911314399072459493765661191058613491863144152352262897351988250431140546660035648795316740212454"};
    for (String s : falsies) {
      boolean result = f.test(s);
      System.out.println(result);
    }
  }
}
```
[Answer]
# JavaScript (ES6), ~~59~~ ~~55~~ ~~51~~ ~~44~~ 42 bytes
```
f=([x,...a],n=0)=>a[0]?f(a,x-a.pop()+n):!n
```
Turns out I was using the wrong strategy entirely. This version recursively finds the sum of the first half minus the sum of the second half, then returns the logical NOT of the result.
If we could return falsy in place of truthy and vice-versa, this would be 35 bytes:
```
f=([x,...a])=>a[0]?x-a.pop()+f(a):0
```
### Test snippet
```
f=([x,...a],n=0)=>a[0]?f(a,x-a.pop()+n):!n
```
```
<input id=I value="23281453796004414"><br>
<button onclick="console.log(`Result of f(${I.value}): `+f(I.value))">Run</button>
```
[Answer]
## Haskell, 55 bytes
```
g(h:t)=read[h]-g(reverse t)
g _=0
(==0).g.(<*"xx").show
```
The recursive function `g` unwraps a number string from both ends by repeatedly taking the head, then reversing. It subtracts the recursive result from the head, which causes it alternate coefficients of +1 and -1, with +1 applied to the first half and -1 to the second half.
```
   g "12345" 
== 1 - g "5432"
== 1 - (5 - g "432")
== 1 - (5 - (4 - g "32"))
== 1 - (5 - (4 - (3 - g "2"))
== 1 - (5 - (4 - (3 - 2))
== 1 + 2 + 3 - 4 - 5
```
So, it takes the sum of the first half minus the sum of the second half. This has the issue that with an odd number of digits, the center tiebreaks to the left, but the main function fixes that by `(<*"xx")`, which doubles every character, i.e. "12345" becomes "1122334455". That way the middle digit splits evenly on both sides and cancels out.
[Answer]
## PowerShell v2+, 85 bytes
```
param($a)!((,'('+$a[0..(($b=$a.length)/2-1)]+'0)-('+$a[($b/2)..$b]+'0)')-join'+'|iex)
```
Takes input `$a` as a string (necessary to support numbers `>2^64-1` without getting into extremely clunky `[biginteger]` casting on the command line).
For the explanation, let's assume input of `'1423'`. We're then constructing a new string. The two array slices are obvious (`$a[...]`), and that's surrounded by three additional strings `(`, `0)-(`, and `0)`, formulating an array of `char`s and `string`s. Note the `,` at the front to enforce array concatenation, not string concatenation.
That whole array is `-join`ed together with `+`, resulting in a string like `(+1+4+0)-(+2+3+0)`, and you can see that the `0`s are needed to prevent syntax errors. That's fed into `|iex` (short for `Invoke-Expression` and similar to `eval`), which will compute the mathematical result. So long as the string is balanced, you'll get `0` as an output, which we encapsulate in parens and take the Boolean-not thereof `!(...)`, to output `True`. If it's any non-zero integer, it'll output `False`.
### Test Cases
```
PS C:\Tools\Scripts\golfing> '1','6','11','141','23281453796004414','523428121656666655655556655656502809745249552466339089702361716477983610754966885128041975406005088'|%{$_;.\is-it-a-balanced-number.ps1 $_;'---'}
1
True
---
6
True
---
11
True
---
141
True
---
23281453796004414
True
---
523428121656666655655556655656502809745249552466339089702361716477983610754966885128041975406005088
True
---
PS C:\Tools\Scripts\golfing> '10','110','15421','5234095123508321','6240911314399072459493765661191058613491863144152352262897351988250431140546660035648795316740212454'|%{$_;.\is-it-a-balanced-number.ps1 $_;'---'}
10
False
---
110
False
---
15421
False
---
5234095123508321
False
---
6240911314399072459493765661191058613491863144152352262897351988250431140546660035648795316740212454
False
---
```
[Answer]
# Perl, 29 bytes
Includes +5 for `-lpF`
Give number on STDIN
```
balanced.pl <<< 1423
```
`balanced.pl`:
```
#!/usr/bin/perl -lpF
$;+=$_-pop@F for@F;$_=!$
```
[Answer]
# C#, 83 bytes
```
n=>{var t=n+"";int l=t.Length,i=0,r=0;for(;i<l/2;)r+=t[i]-t[l-1-i++];return r==0;};
```
[**Try it online!**](http://ideone.com/PtJ5bm)
Full source, including test case:
```
using System;
using System.Numerics;
namespace BalancedNumber
{
    class Program
    {
        static void Main(string[] args)
        {
            Func<BigInteger,bool>s= n=>{var t=n+"";int l=t.Length,i=0,r=0;for(;i<l/2;)r+=t[i]-t[l-1-i++];return r==0;};
            Console.WriteLine(s(1));    //true
            Console.WriteLine(s(6));    //true
            Console.WriteLine(s(11));   //true
            Console.WriteLine(s(141));  //true
            Console.WriteLine(s(23281453796004414));    //true
            BigInteger bi = BigInteger.Parse("523428121656666655655556655656502809745249552466339089702361716477983610754966885128041975406005088");
            Console.WriteLine(s(bi));   //true
            Console.WriteLine(s(10));   //false
            Console.WriteLine(s(12));   //false
            Console.WriteLine(s(110));  //false
            Console.WriteLine(s(15421));    //false
            Console.WriteLine(s(5234095123508321)); //false
            bi = BigInteger.Parse("6240911314399072459493765661191058613491863144152352262897351988250431140546660035648795316740212454");
            Console.WriteLine(s(bi));   //false
        }
    }
}
```
The BigInteger data type allows any number length. If the number is too large, the compiler complains (*error CS1021: Integral constant is too large*), so the **BigInteger.Parse(String)** method is used instead.
The solution can actually be reduced to **72 bytes** considering the input is a string (and updating the program accordingly):
```
t=>{int l=t.Length,i=0,r=0;for(;i<l/2;)r+=t[i]-t[l-1-i++];return r==0;};
```
[Answer]
## Python 3, ~~107~~ ~~102~~ 76 bytes
```
n=input()
l=len(n)
print(sum(map(int,n[:l//2]))==sum(map(int,n[l//2+l%2:])))
```
-26 bytes by [@Rod](https://codegolf.stackexchange.com/users/47120/rod)!
[Answer]
## Ruby, 63 bytes
```
->s{e=s.chars*?+
l=s.size
e[l-1-r=l%2,2*r+1]="=="
l<2||eval(e)}
```
Note: arg `s` must be string.
### Testing(minitest 5+ required):
```
require 'minitest/autorun'
class TestRunner < Minitest::Test
  def setup
    @truthy_nums = %w(1 6 11 141 23281453796004414 523428121656666655655556655656502809745249552466339089702361716477983610754966885128041975406005088)
    @falsy_nums = %w(10 110 15421 5234095123508321 6240911314399072459493765661191058613491863144152352262897351988250431140546660035648795316740212454)
@f=->s{e=s.chars*?+
l=s.size
e[l-1-r=l%2,2*r+1]="=="
l<2||eval(e)}
  end
  def test_true
    @truthy_nums.each do |e|
      assert @f[e], e
    end
  end
  def test_false
    @falsy_nums.each do |e|
      assert !@f[e], e
    end
  end
end
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 4 bytes
```
YIṠ≈
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCLilqE6xpsiLCJZSeG5oOKJiCIsIjskWsabYCA8PSBgajvigYsiLCIxXG42XG4xMVxuMTQxXG4xMjIxXG4yMzI4MTQ1Mzc5NjAwNDQxNFxuNTIzNDI4MTIxNjU2NjY2NjU1NjU1NTU2NjU1NjU2NTAyODA5NzQ1MjQ5NTUyNDY2MzM5MDg5NzAyMzYxNzE2NDc3OTgzNjEwNzU0OTY2ODg1MTI4MDQxOTc1NDA2MDA1MDg4XG4xMFxuMTJcbjExMFxuMTU0MjFcbjUyMzQwOTUxMjM1MDgzMjFcbjYyNDA5MTEzMTQzOTkwNzI0NTk0OTM3NjU2NjExOTEwNTg2MTM0OTE4NjMxNDQxNTIzNTIyNjI4OTczNTE5ODgyNTA0MzExNDA1NDY2NjAwMzU2NDg3OTUzMTY3NDAyMTI0NTQiXQ==)
Beats all other answers.
## How?
```
YIṠ≈
Y     # Interleave the input with itself, giving a list with each digit duplicated
 I    # Split into two halves
  Ṡ   # Sum each
   ≈  # Is this list all equal?
```
# [05AB1E](https://github.com/Adriandmen/05AB1E), 6 bytes
```
.ι2äOË
```
[Try it online!](https://tio.run/##yy9OTMpM/f9f79xOo8NL/A93//9vaGRkCAA "05AB1E – Try It Online")
Same concept.
[Answer]
# Retina, ~~64~~ 44 bytes
```
^((.)*?).?(?=(?<-2>.)*$)
$1 
\d
$*
^(1+) \1$
```
[**Try it online**](http://retina.tryitonline.net/#code=XigoPzouKD89Lio_KD8oMikoPz0uXDIkKSkoLlwyPyQpKSkqKSguKS4qCiQxICQyClxkCiQqCl4oMSspIFwxJA&input=MjMyODE0NTM3OTYwMDQ0MTQ)
The first stage splits the string in the middle, omitting the middle character if there is one (~~taken and modified from [here](https://stackoverflow.com/a/28052126/2415524).~~ Courtesy of Martin.) Then, replace digits with their unary representation, and match if the two halves are of equal length.
[Answer]
## JavaScript (ES6), ~~74~~ ~~67~~ ... ~~59~~ 50 bytes
Recursively sums the difference of the first and last digits until there's less than two digits left:
```
let f =
n=>!(F=n=>n[1]?(n.pop()-n.shift()+F(n)):0)([...n])
// some truthy examples
console.log(f("11"));
console.log(f("141"));
console.log(f("523428121656666655655556655656502809745249552466339089702361716477983610754966885128041975406005088"));
// some falsy examples
console.log(f("12"));
console.log(f("110"));
console.log(f("6240911314399072459493765661191058613491863144152352262897351988250431140546660035648795316740212454"));
```
[Answer]
# R, ~~105~~ 96 bytes
Turns out R is very verbose. Takes input as a character.
```
function(x){y<-as.numeric(unlist(strsplit(x,"")));l<-length(y)%/%2;sum(tail(y,l))==sum(head(y,l))}
```
Formatted nicely:
```
function(x){
    y=as.numeric(unlist(strsplit(x,"")))
    l=length(y)%/%2
    sum(tail(y,l))==sum(head(y,l))
}
```
Explanation
* `y<-as.numeric(unlist(strsplit(x,"")))` Split the input (a string\_, and coerce it to a vector instead of a list, and then turn it back into integers.
* `sum(tail(y,`: `tail` takes the last *n* elements, found by:
	+ `length(y)%/%2))`, where `%/%` is integer division, to get the ceiling of the quotient, where the length is odd.
* `sum(head(y,length(y)%/%2))`: like `tail`, `head` takes the first *n* elements of the vector, found in the same way.
## Edits
* Saved seven bytes thanks to niam
* Switched to `=` instead of `<-` , saved another two bytes.
[Answer]
# [Brain-Flak](https://github.com/DJMcMayhem/Brain-Flak), ~~410~~ ~~206~~ ~~204~~ 178 + 3 = 181 bytes
Here is a 178 byte version that uses the `-a` flag.
*26 bytes golfed off by DJMcMayhem*
[Try it Online](http://brain-flak.tryitonline.net/#code=KFtdKSg8KCgpKCkoPD4pKT4pPD57KHt9WygpXSk8Pigoe30oKVsoe308KHt9KCkpPildKSl7e30oPCh7fSh7fTwoe31bKCldKT4pKT4pfXt9PD59e308Pnt9e30oe308Pil7KHt9WygpXTwoe308Pik8Pj4pfXt9KFtdPD5bW11dPD4peyg8e317fT4pfXt9KHt7fTw-W3t9XTw-fTwoKCkpPil7e317fSgoPD4pKX17fQ&input=MTIxMzExMg&args=LWE)
```
([])(<(()()(<>))>)<>{({}[()])<>(({}()[({}<({}())>)])){{}(<({}({}<({}[()])>))>)}{}<>}{}<>{}{}({}<>){({}[()]<({}<>)<>>)}{}([]<>[[]]<>){(<{}{}>)}{}({{}<>[{}]<>}<(())>){{}{}((<>))}{}
```
Here is a longer 410 byte version that does not use the `-a` flag.
[Try it Online](http://brain-flak.tryitonline.net/#code=eygoe30pKSg8KCgoKSgpKCkoKSgpKXt9PD4pPik8Pnsoe31bKCldKTw-KCh7fSgpWyh7fSldKSl7e30oPCh7fSh7fSkpPil9e308Pn17fTw-KHt9PHt9Pik8Pig8KCgoKSgpKCkoKSgpKXt9KDw-KSk-KTw-eyh7fVsoKV0pPD4oKHt9KClbKHt9PCh7fSgpKT4pXSkpe3t9KDwoe30oe308KHt9WygpXSk-KSk-KX17fTw-fXt9PD57fXt9KHt9PD4pfXt9PD4oW10pKDwoKCkoKSg8PikpPik8Pnsoe31bKCldKTw-KCh7fSgpWyh7fTwoe30oKSk-KV0pKXt7fSg8KHt9KHt9PCh7fVsoKV0pPikpPil9e308Pn17fTw-e317fSh7fTw-KXsoe31bKCldPCh7fTw-KTw-Pil9e30oW108PltbXV08Pil7e317fSg8Pil9e30oKFtdKTw-KSh7PHt9Pnt9PChbXSk-fXt9PD5bezx7fT57fTwoW10pPn17fV08KCgpKT4pe3t9e30oKDw-KSl9e30&input=MTI0MDM)
```
{(({}))(<((()()()()()){}<>)>)<>{({}[()])<>(({}()[({})])){{}(<({}({}))>)}{}<>}{}<>({}<{}>)<>(<((()()()()()){}(<>))>)<>{({}[()])<>(({}()[({}<({}())>)])){{}(<({}({}<({}[()])>))>)}{}<>}{}<>{}{}({}<>)}{}<>([])(<(()()(<>))>)<>{({}[()])<>(({}()[({}<({}())>)])){{}(<({}({}<({}[()])>))>)}{}<>}{}<>{}{}({}<>){({}[()]<({}<>)<>>)}{}([]<>[[]]<>){{}{}(<>)}{}(([])<>)({<{}>{}<([])>}{}<>[{<{}>{}<([])>}{}]<(())>){{}{}((<>))}{}
```
# Explanation
Here is an explanation of the shorter solution
To begin the number is converted to all of its ASCII values by the `-a` flag.
We push the stack height (i.e. number of digits) and divide by two.
```
([])(<(()()(<>))>)<>{({}[()])<>(({}()[({}<({}())>)])){{}(<({}({}<({}[()])>))>)}{}<>}{}<>{}{}({}<>)
```
For each number less than the number we just pushed we move a digit to the other stack
```
{({}[()]<({}<>)<>>)}{}
```
If the stacks have different heights we remove the top item from the current stack
```
([]<>[[]]<>){(<{}{}>)}{}
```
We want the difference between the sums of each stack. So we use the following algorithm to sum each stack.
```
{{}}
```
This assumes no digit has an ASCII value of zero, which is a valid assumption.
We run this for both stacks and take the difference (The `<(())>` is necessary for the next part.
```
({{}}<>[{{}}]<(())>)
```
We now want to negate the sum. If the sum is zero it will pop the top off revealing the one we pushed earlier otherwise it will remove both the number and the one and place a zero on top.
```
{{}{}((<>))}{}
```
[Answer]
# Actually, ~~17~~ 16 bytes
This answer is inspired by [ElPedro's Python 2 answer](https://codegolf.stackexchange.com/a/94314/47581) and their idea to use `[-b:]`. Golfing suggestions welcome. [Try it online!](http://actually.tryitonline.net/#code=JOKZguKJiDtswr1M4pSCwrFhSM6jKXTOoz0&input=NTIzNDI4MTIxNjU2NjY2NjU1NjU1NTU2NjU1NjU2NTAyODA5NzQ1MjQ5NTUyNDY2MzM5MDg5NzAyMzYxNzE2NDc3OTgzNjEwNzU0OTY2ODg1MTI4MDQxOTc1NDA2MDA1MDg4)
```
$♂≈;l½L│±aHΣ)tΣ=
```
**Ungolfing**
```
      Implicit input n.
$♂≈   list(str(n)). This converts n to a list of n's digits.
;l    Duplicate the list of digits and get its length. Call it len.
½L    Push len//2.
│     This duplicates the stack.
        Stack: len//2, digit_list, len//2, digit_list
±     Negate the len//2 at TOS for later.
a     Invert the stack.
        Stack: digit_list, len//2, digit_list, -(len//2)
HΣ    Push digit_list[:len//2], then push its sum.
)     Rotate this first sum to BOS.
tΣ    Push digit_list[-(len//2):], then push its sum.
=     Check if those sums are equal.
      Implicit return.
```
[Answer]
# [Perl 6](https://perl6.org), ~~42 39~~ 33 bytes
```
{[==] .comb[{^($_/2),Int($_/2)..*}]>>.sum}
```
[Test it](https://tio.run/##ZZFNj9MwEIbv/hWzotAESuPxV@xW6SIOSFw47QFpWVBoXTYiTavErVpV4a@XcQrLSkSJM/Nm3vHjyc63tbnsOw8HM13O2eYEr5bblYficr4vigeYLreb7/fnr8noWybSyccmXKPp9HX/sFhMu/2mv5DrZfBdgFkBddX4Lkmny7rsump9mp0ZQBfK4OH9dlvD6DgnYXSEAm6zWQWh3fsMqjVk47vYYll2vhtnsSj7ssrg9jYW39zAp6qeA7yA1od928Q0usKjbz2UrW/GAcrmBKvqRxU61rOB6Exl/Wzlax88uaP/mkTjlZWiMsBqGxs8lgf/vAsd7N1wsALWNVUld0QLn4vFNb1uEbU@nUDyoay7/74OYp/OGYtTjkecs11dNvBm6Ez6etv@2eXtApLZT39KRv6488vgV@lkdijrvU9GVbPbhzSFOM6qg/iT/ooTeKqncNDgF4yBQMYUPH1k/eXfiCGJk08ZQ2YYIkNFjxDIhBQWlZa5M5wrhYppIRVpAo028dKablqGwGguLHe50kI5TYsxUjpuXc6FNJijUXnuLIU818oZY61Gcih0lHPaQ3NrGXtOto4zi2ickAiOXloRWgThjuySPJIEIyhHlKikczwXSjvlZB45ER1ybQ1K5dAaKlFIfi2EEQQnNTprheZKIiquCZtQpDbK5k5LNLniAqmh@g0 "Perl 6 – Try It Online")
```
{[==] .comb[^(*/2),(*/2).Int..*]>>.sum}
```
[Test it](https://tio.run/##ZZFNj9MwEIbv/hWzotBkKYnHX7FbpYs4IHHhtAekZZFC67IRaVolbtWqKn@9jFNYViJKnJk3844fT7a@a8xl13vYm2wxY@sjvFlslh7Ky@mhLB8hW2zW3x@@Jbe5SCfDmn1qQ5bdPs7nWb9bny9keR18H2BaQlO3vk/SbNFUfV@vjtMTA@hDFTx82GwaGB1mJIwOUMJdPq0hdDufQ72CfHwfWyyq3vfjPBblX5c53N3F4psb@Fw3M4BX0Pmw69qYRld48p2HqvPtOEDVHmFZ/6hDz85sIDpR2Xm69I0PntzRf02i8cpKURVguYkNnqq9f9mFDvZ@OFgJq4aqknuihS/l/Jpet4jaOZ1A8rFq@v@@DuI5nTEWRxyPOGPbpmrh7dCZ9NWm@7PLuzkk05/@mIz8YesXwS/TyXRfNTufjOp2uwtpCnGcdQ/xD/0VJ/BcT@GgwS8YA4GMKXj@yM6XfyOGJE4@ZQyZYYgMFT1CIBNSWFRaFs5wrhQqpoVUpAk02sRLa7ppGQKjubDcFUoL5TQtxkjpuHUFF9JggUYVhbMU8kIrZ4y1Gsmh0FHOaQ/NrWXsJdkqziyicUIiOHppRWgRhDuyS/JIEoygHFGiks7xQijtlJNF5ER0yLU1KJVDa6hEIfm1EEYQnNTorBWaK4mouCZsQpHaKFs4LdEUigukhuo3 "Perl 6 – Try It Online")
```
{[==] .comb[^*/2,^*/2+*/2]>>.sum}
```
[Test it](https://tio.run/##ZVFNj9owEL37V8yqtCRdSjz@ig0Ku@qhx572UGm7ldJgulFDQIlBIJT@dTqGdrtSo3gy8/ze@Hmy9V1jzrvew95MqzlbH@FdtVl6KM6nx6J4gmm1WX9//PY@E5MYbmk9LRbTfrcezkR@G3wfYFZAU7e@T9Jp1ZR9X6@OsxMD6EMZPHzcbBoYHeYEjA5QwF02qyF0O59BvYJs/BBbVGXv@3EWSdnXZQZ3d5F8cwOf62YO8AY6H3ZdG8uoCs@@81B2vh0HKNsjLOsfdejZwC6OTkQbZkvf@OBJHfXXIgqvXikrAyw3scFzufevu9DF7i8XK2DVECt5ILfwpVhcy@sRERvSCSSfyqb/b/cCDumcsTjceMU52zZlC7eXzoSvNt2fUz4sIJn99Mdk5A9bXwW/TCezfdnsfDKq2@0upCnEcdY9xH/zF5zAC5/SCwa/YAxkZEzJyyYbzv9GDEmcfMoYMsMQGSpaQiATUlhUWubOcK4UKqaFVIQJNNrER2t6KVwSo7mw3OVKC@U0BWOkdNy6nAtpMEej8txZSnmulTPGWo2kUOio5nSG5tYy9trZKs4sWuNkiczRRyuyFo1wR3JJGkmAEVQjSlTSOZ4LpZ1yMo8@ER1ybQ1K5dAaoigkvRbCCDInNTprheZKIiquyTZZkdoomzst0eSKC6SG6jc "Perl 6 – Try It Online") (from [Jo King](https://codegolf.stackexchange.com/users/76162/jo-king))
## Explanation:
```
{ # lambda with implicit parameter ｢$_｣
  [==]                   # reduce the following using &infix:«==»
    .comb\               # split input into individual characters
    [                    # index into that using:
      # first half of the values (includes middle value)
      # ｢(0/2) ..^ (*/2)｣
      ^ * / 2,     
      # last half of the values (includes middle value)
      ^ * / 2            # same number of values as first half
        + * / 2          # shifted up by half
    ]\
    >>.sum               # sum each of the two halves separately
}
```
[Answer]
# Javascript, 73 bytes
Good ol' ES5 loops
```
for(a=c=0,b=(l=(s=prompt()).length)-1;a<~-l/2;c-=s[a++]-s[b--]);alert(!c)
```
What's happening here?
```
for(
    a=c=0,               // a = left digits of the number
                         // c = the result
    b=                   // b = right digits of number
        (l=              // l = length of number - 1
            (s=prompt()) // s = the number as input from user
        .length)-1; 
    a<~-l/2;             // while a < length of number / 2, rounded down (~-)
    c-=
        s[a++]           // c -= left digit
        -
        s[b--]           // c += right digit (because - and - == +)
 );
                         // for balanced numbers c should be 0
 alert(!c)               // 0 equals false in javascript, so output the opposite of c
```
[Answer]
# Python 2, 73 bytes
```
def f(n):x=map(int,str(n));d=len(x)/2;print sum(x[:d])==sum(x[-d:])or d<1
```
Tests are at **[ideone](http://ideone.com/I98HFT)**
We have to use `str()` rather than `` since `n` may be outside the range of signed int.
[Answer]
# Python 2, ~~83~~ 77 bytes
```
g=[int(h)for h in raw_input()];b=int(len(g)/2);print sum(g[:b])==sum(g[-b:])or b==0
```
**EDIT**
reduced to 77 with help from @Rod
```
g=[int(h)for h in raw_input()];b=len(g)/2;print sum(g[:b])==sum(g[-b:])or b<1
```
Examples:
```
D:\>bal.py
1
True
D:\>bal.py
6
True
D:\>bal.py
523428121656666655655556655656502809745249552466339089702361716477983610754966885128041975406005088
True
D:\>bal.py
10
False
D:\>bal.py
110
False
D:\>bal.py
 6240911314399072459493765661191058613491863144152352262897351988250431140546660035648795316740212454
False
```
[Answer]
# PHP, ~~73~~ ~~67~~ ~~60~~ 57 bytes
Requires PHP 7.1 for negative string offsets:
```
for(;2*$x<strlen($a=$argn);)$s+=$a[$x++]-$a[-$x];echo!$s;
```
Run:
```
echo 15324 | php -nR 'for(;2*$x<strlen($a=$argn);)$s+=$a[$x++]-$a[-$x];echo!$s;';echo
```
# Previous version
Note: requires PHP 7 for the spaceship operator.
```
for(;$x<$l=strlen($a=$argv[1]);)$s+=(2*$x<=>$l-1)*$a[$x++];echo!$s;
```
Run like this:
```
php -d error_reporting=30709 -r 'for(;$x<$l=strlen($a=$argv[1]);)$s+=(2*$x<=>$l-1)*$a[$x++];echo!$s;' -- 15324;echo
```
## Explanation
Iterates over the digits in the number. Checks if the digit belongs to the first half or the second half (or is the middle digit) by comparing the digit's index to the length of the input with combined comparison (`2 * $x <=> $l - 1`). Then multiply that with the digit, take the sum of all digits. If it's a balanced number, the sum will be `0`.
Example with input `15324`:
```
  index     0  1  2  3  4 
  digit     1  5  3  2  4
  2*index   0  2  4  6  8
  length-1  4  4  4  4  4
  factor    1  1  0 -1 -1  # Result of the spaceship operator
  result    1  5  0 -2 -4
           --------------
  sum                   0
```
# Tweaks
* Don't set the digit to `$d`, just iterate the length of the input. Saved 5 bytes.
* String offset `null` doesn't have to be cast to `int` for PHP to interpret it as `0`. Saved 1 byte.
* Using negative string offsets to get the digits from the second half and iterating to half of the string. Saved 7 bytes, but requires PHP 7.1
* Saved 3 bytes by using `$argn`
[Answer]
## Clojure, ~~66~~ 64 bytes
Update: Took `str` out from the `map int` function.
```
(comp #(=(apply +(map -(drop(/(count %)2)%)%))0)#(map int %)str)
```
This would have been shorted if the input format was more flexible, now I had to first map the integer into a sequence of ASCII values. The inner `map` calculates pair-wise differences of values from the two halves, and this checks if the sum of deltas is zero.
`((comp f g h) x y z)` = `(f (g (h x y z))`.
Actually this ended up being the same length as just doing the mapping within a `let` and just define a single function.
[Answer]
# [Factor](https://factorcode.org/) + `math.unicode sequences.repeating`, 32 bytes
```
[ 2 repeat halves [ Σ ] same? ]
```
[Try it online!](https://tio.run/##RVBLTgMxDN3nFDlB5X9iWLBEbNggVlUXoxJoRTudTqdUCHEa7sOVigsLIsexX2y/Jz93y2k3nh8f7u5vr/Kh7Y@tX7bDbGxD66Z1//KP5dc29m2Tt920mh379XL31PIwtml6H8Z1P@X9KV@ntD99JEyWEBNKXCJMxFRRlIsbgAhKUmIJjNDULkc1LNxvYApUwYsoiWs4M2aH6gWIDQualOI1QigqblarYnQIeuQQHAq1JoRgDx3xqISKCyd4VHJ8cwBGkSMyCrtDIVEX53KRhOgIWg1ZHKtFiWD0K5FR6GBFr5UUhBEFNBQGK6tJLa6MVgQIY6Ckz/M8U/7bZ151m7fY5Dx/f@VFPnTbdpMX52035Nn5Bw "Factor – Try It Online")
```
            ! "141"
2 repeat    ! "114411"
halves      ! "114" "411"
[ Σ ] same? ! t
```
[Answer]
# C (GCC), 66 bytes
```
char*c,*d;i;f(s){for(d=index(c=s,i=0);c<--d;)i+=*c++-*d;return!i;}
```
[Try It Online!](https://tio.run/##lVFNSwNBDL33V9QFYbcfkMwkmYlrr/4Cj72U2a0u6Cq7WxBKf3tNVRA9OBiGkCEvj@S9tH5I6XxOj7thkVaLpu7qfTlWx/3LUDabrm/atzJtxlW3gapOt@t1U1fdcrNIy@Xa0EM7HYb@qqtP5@dd15fV7Dibf8XrYRrL4n44tPOpHad52o3teFNU9Tdi6PppXxbXzbYvVnOrsKj@7EumjzkCpCzCuRzEeReR2AcVACKkDJ6dJ5twKCyXYLZn6aMQBhdBA7EjZUsi3itEDeC8YEChEDRaCYFJRWJktAlCtT/YBgwx/tjglwXb/m73NP7HBchqlPUhS8GU1fmiG6hd6@1En4WLMzSiR/KqEByxkvpwER1RETgKelKMYhBCY2fnxJnSnlFjdAzkEQnYPDBdPQvFoOxRAoFDI/x0@nR@Bw)
Explanation:
```
char*c,*d;i;
f(s)
{
    // d = the first null-terminator in s, c = s, i = 0
    // Before the first and after each iteration, decrement d and break out of
    // the loop if c has surpassed d.
    for(d=index(c=s,i=0);c<--d;)
        // Add the ascii values of c and d to i, increment c.
        // The ascii values of a number equals the ascii value of 0 plus the
        // number, so if numbers j and k are respectively stored in c and d,
        // *c - *d = (i + '0') - ('j + '0') = i - j = the signed difference
        i+=*c++-*d;
    // If the sum of the signed differences are 0, return 1; otherwise 0
    return!i;
}
```
[Answer]
# sed (165 + 1 for -r) 166
```
/^.$/c1
:l;s,^([^!])([^!]*)([^!])!?([^=]*)=?(.*),\2!\4\1=\5\3,;tl;:
s,.?!|0,,;s,2,11,;s,3,21,;s,4,31,;s,5,41,;s,6,51,;s,7,61,
s,8,71,;s,9,81,;t;s,1=1,=,;t;/^=$/c1
c0
```
Output:  
1 for true  
0 for false
[Try it online!](http://sed.tryitonline.net/#code=L14uJC9jMQo6bDtzLF4oW14hXSkoW14hXSopKFteIV0pIT8oW149XSopPT8oLiopLFwyIVw0XDE9XDVcMyw7dGw7OgpzLC4_IXwwLCw7cywyLDExLDtzLDMsMjEsO3MsNCwzMSw7cyw1LDQxLDtzLDYsNTEsO3MsNyw2MSwKcyw4LDcxLDtzLDksODEsO3Q7cywxPTEsPSw7dDsvXj0kL2MxCmMw&input=MQo2CjExCjE0MQoxMjIxCjIzMjgxNDUzNzk2MDA0NDE0CjUyMzQyODEyMTY1NjY2NjY1NTY1NTU1NjY1NTY1NjUwMjgwOTc0NTI0OTU1MjQ2NjMzOTA4OTcwMjM2MTcxNjQ3Nzk4MzYxMDc1NDk2Njg4NTEyODA0MTk3NTQwNjAwNTA4OAoxMAoxMgoxMTAKMTU0MjEKNTIzNDA5NTEyMzUwODMyMQo2MjQwOTExMzE0Mzk5MDcyNDU5NDkzNzY1NjYxMTkxMDU4NjEzNDkxODYzMTQ0MTUyMzUyMjYyODk3MzUxOTg4MjUwNDMxMTQwNTQ2NjYwMDM1NjQ4Nzk1MzE2NzQwMjEyNDU0&args=LXI)
[Answer]
# Python 2.7, 102 92 bytes
For loop works better :/
```
s=`input()`
a,b,l=0,0,len(s)
for i in range(l/2):a=a+int(s[i]);b=b+int(s[l-i-1])
print a==b
```
Same idea, just use length - i to get other side. It will never reach the center of an odd number.
Old code 
```
s=input()
l=len(s)
def n(i):return 0if not i else int(i[0])+n(i[1:])
print n(s[:l/2])==n(s[l/2+l%2:])
```
Gets input  
Saves length of input  
Recursive func to get sum of string  
Compare the first half sum to the second half sum
Trying to get it below 100, but its hard :/
[Answer]
# C function, 74
```
l;i;t;f(char *n){l=strlen(n);for(t=i=0;i<l/2;)t+=n[i]-n[l-++i];return !t;}
```
[Ideone.](https://ideone.com/O1i46p)
]