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.

Showing 1-2 of 2 results.

A147808 Sum of n-digit numbers which are balanced: the first [n/2] digits have the same sum as the last [n/2] digits.

Original entry on oeis.org

45, 495, 49500, 3314850, 331431000, 27336542310, 2733612983100, 238305122029260, 23830484311542600, 2140037814262627400, 214003761418373774000, 19587943639318412097360, 1958794348735327250973600, 181693537570273520779480800
Offset: 1

Views

Author

M. F. Hasler, Nov 23 2008

Keywords

Comments

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.)
Up to n=3 digits, the only balanced numbers are the palindromes, from n=4 on, there are non-palindromic balanced numbers, cf. A145808.

Examples

			a(1) = 1+2+...+9; a(2) = 11+22+...+99 = 11 a(1); a(3) = 101+111+121+....+191+202+...+989+999 = (101*10 + 10*9)*a(1); a(4) = 1001+1010+1102+1111+1120+1203+...+9889+9898+9999.
		

Programs

  • Mathematica
    balQ[n_]:=Module[{idn=IntegerDigits[n],len=Floor[IntegerLength[n]/2]}, Total[ Take[ idn,len]] == Total[Take[idn,-len]]]; Table[Total[ Select[ Range[ 10^n, 10^(n+1)-1],balQ]],{n,0,5}] (* This will generate the first six terms of the sequence.  To generate more, (1) change the range of the Table from (0,5) to (0,6) or (0,7), etc., but the program will take increasingly long to run. *) (* Harvey P. Dale, Apr 07 2013 *)
  • PARI
    A147808(n)={ local( t,c ); if( n==1, 45, /* global variable SC[sd] (used for n=2k and n=2k+1) stores [sum,count] of numbers with <= n\2 digits and digit sum = sd */ if( #SC != n\2*9, SC=vector( n\2*9, digsum, c=0; [sum( i=0,10^(n\2)-1, if((i-digsum)%9==0 && digsum==sum(j=1,#t=Vecsmall(Str(i)),t[j])-48*#t, c++; i )), c] )); if( n%2==0, sum( i=10^((n\=2)-1),10^n-1, SC[A007953(i)]*[1,i*10^n]~ ), t=10^(n\=2)*[100,45]~; sum( i=10^(n-1),10^n-1, SC[A007953(i)]*[10,[i,1]*t]~ )))}

Formula

lim a(2n+1)/a(2n) = 100, lim a(2n)/a(2n-1) = 90 (as n -> oo).

Extensions

a(13)-a(14) from Kevin P. Thompson, Dec 05 2021

A147842 Sum of all balanced numbers less than 10^n.

Original entry on oeis.org

45, 540, 50040, 3364890, 334795890, 27671338200, 2761284321300, 241066406350560, 24071550717893160, 2164109364980520560, 216167870783354294560, 19804111510101766391920, 1978598460245429017365520, 183672136030518949796846320
Offset: 1

Views

Author

Alexis Olson (AlexisOlson(AT)gmail.com), Nov 14 2008

Keywords

Comments

See reference for definition of balanced number.
Partial sums of A147808. Up to n=3, equal to the sum of palindromes A002113 < 10^n; then it differs from this sequence by the sum of terms < 10^n in A145808. - M. F. Hasler, Nov 23 2008

Programs

Formula

a(n) = Sum_{k=1..n} A147808(k). - M. F. Hasler, Nov 23 2008

Extensions

a(9)-a(12) from M. F. Hasler, Nov 23 2008
a(13)-a(46) added by Wei Zhou, Oct 10 2011
Showing 1-2 of 2 results.