A145808 Non-palindromic balanced numbers: the first and the last half of digits have the same sum.
1010, 1102, 1120, 1203, 1212, 1230, 1304, 1313, 1322, 1340, 1405, 1414, 1423, 1432, 1450, 1506, 1515, 1524, 1533, 1542, 1560, 1607, 1616, 1625, 1634, 1643, 1652, 1670, 1708, 1717, 1726, 1735, 1744, 1753, 1762, 1780, 1809, 1818, 1827, 1836, 1845, 1854
Offset: 1
Links
- Zak Seidov, Table of n, a(n) for n=1..1000 [From _Zak Seidov_, Oct 20 2009]
- Project Euler, Problem 217: Balanced Numbers.
Crossrefs
Cf. A147808.
Programs
-
Mathematica
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 *) 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 *)
-
PARI
is_A145808(n) = is_balanced(n) & !is_A002113(n) 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 }
Comments