cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A145808 Non-palindromic balanced numbers: the first and the last half of digits have the same sum.

This page as a plain text file.
%I A145808 #13 Aug 10 2025 18:30:45
%S A145808 1010,1102,1120,1203,1212,1230,1304,1313,1322,1340,1405,1414,1423,
%T A145808 1432,1450,1506,1515,1524,1533,1542,1560,1607,1616,1625,1634,1643,
%U A145808 1652,1670,1708,1717,1726,1735,1744,1753,1762,1780,1809,1818,1827,1836,1845,1854
%N A145808 Non-palindromic balanced numbers: the first and the last half of digits have the same sum.
%C A145808 Numbers such that the first half of digits have the same sum than the last half of digits are called balanced in the linked "Problem 217". (Note that here the meaning of "balanced" is neither that of A020492, nor that of A031443.)
%C A145808 Clearly all palindromes (A002113) have this property. Since the first non-palindromic example, 1010, comes only after A002113(109)=1001, we list here only non-palindromic balanced numbers.
%H A145808 Zak Seidov, <a href="/A145808/b145808.txt">Table of n, a(n) for n=1..1000</a> [From _Zak Seidov_, Oct 20 2009]
%H A145808 Project Euler, <a href="http://projecteuler.net/index.php?section=problems&amp;id=217">Problem 217: Balanced Numbers</a>.
%F A145808 A145808 = { m | A007953([m/10^A110654(A055642(m))]) = A007953(m mod 10^A004526(A055642(m))) } \ A002113
%t A145808 Reap[Do[id=IntegerDigits[n];m=Floor[Length[id]/2];If[Reverse[id]!=id&&Total[Take[id,m]]==Total[Take[id,-m]],Sow[n]],{n,1010,2000}]][[2,1]] (* _Zak Seidov_, Oct 20 2009 *)
%t A145808 npbnQ[n_]:=Module[{idn=IntegerDigits[n],len},len=Floor[Length[idn]/2];idn!=Reverse[idn]&&Total[Take[idn,len]]==Total[Take[idn,-len]]]; Select[ Range[1000,2000],npbnQ] (* _Harvey P. Dale_, Sep 25 2012 *)
%o A145808 (PARI) is_A145808(n) = is_balanced(n) & !is_A002113(n)
%o A145808 is_balanced(n) = { local( d, t=1+#Str(n)); (n\10^(t\2)-n%10^((t-1)\2)) % 9 && return; d=Vecsmall(Str(n)); sum(i=1,(t-1)\2,d[i]-d[t-i])==0 }
%Y A145808 Cf. A147808.
%K A145808 base,easy,nice,nonn
%O A145808 1,1
%A A145808 _M. F. Hasler_, Nov 17 2008