This site is supported by donations to The OEIS Foundation.

 Please make a donation to keep the OEIS running. We are now in our 55th year. In the past year we added 12000 new sequences and reached 8000 citations (which often say "discovered thanks to the OEIS"). We need to raise money to hire someone to manage submissions, which would reduce the load on our editors and speed up editing. Other ways to donate

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A055017 Difference between sums of alternate digits of n starting with the last, i.e., (Sum of ultimate digit of n, antepenultimate digit of n,...)-(sum of penultimate digit of n, preantepenultimate digit of n,...). 19
 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, -8, -7, -6, -5, -4, -3 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,3 COMMENTS n is divisible by 11 iff a(n) is a multiple of 11 Digital sum with alternating signs starting with a positive sign for the rightmost digit. - Hieronymus Fischer, Jun 18 2007 For n<100 equal to (n mod 10 - floor(n/10)) = -A076313(n). - Hieronymus Fischer, Jun 18 2007 LINKS Hieronymus Fischer, Table of n, a(n) for n = 0..10000 FORMULA From Hieronymus Fischer, Jun 18 2007, Jun 25 2007, Mar 23 2014: (Start) a(n)=n+11*sum{k>0,(-1)^k*floor(n/10^k)}. a(10n+k)=k-a(n), 0<=k<10. G.f. g(x)=sum{k>0, (x^k-x^(k+10^k)+(-1)^k*11*x^(10^k))/(1-x^(10^k))}/(1-x). a(n)=n+11*sum{10<=k<=n, sum{j|k,j>=10, (-1)^floor(log_10(j))*(floor(log_10(j))-floor(log_10(j-1)))}}. G.f. expressed in terms of Lambert series: g(x)=(x/(1-x)+11*L[b(k)](x))/(1-x) where L[b(k)](x)=sum{k>=0, b(k)*x^k/(1-x^k)} is a Lambert series with b(k)=(-1)^floor(log_10(k)), if k>1 is a power of 10, else b(k)=0. G.f.: g(x)=sum{k>0, (1+11*c(k))*x^k}/(1-x), where c(k)=sum{j>1,j|k, (-1)^floor(log_10(j))*(floor(log_10(j))-floor(log_10(j-1)))}. Formulas for general bases b > 1 (b = 10 for this sequence). a(n) = sum_{k>=0} (-1)^k*(floor(n/b^k) mod b). a(n) = n + (b+1)*sum_{k>0} (-1)^k*floor(n/b^k). Both sums are finite with floor(log_b(n)) as the highest index. a(n) = a(n mod b^k) + (-1)^k*a(floor(n/b^k)), for all k>=0. a(n) = a(n mod b) - a(floor(n/b)). a(n) = a(n mod b^2) + a(floor(n/b^2)). a(n) = (-1)^m*A225693(n), where m = floor(log_b(n)). a(n) = (-1)^k*A225693(A004086(n)), where k = is the number of trailing ‘0’s of n, formally, k = max(j | n == 0 mod 10^j). a(A004086(A004086(n))) = (-1)^k*a(n), where k = is the number of trailing ‘0’s in the decimal representation of n. (End) EXAMPLE a(123)=3-2+1=2, a(9875)=5-7+8-9=-3. MAPLE sumodigs := proc(n) local dg; dg := convert(n, base, 10) ; add(op(1+2*i, dg), i=0..floor(nops(dg)-1)/2) ; end proc: sumedigs := proc(n) local dg; dg := convert(n, base, 10) ; add(op(2+2*i, dg), i=0..floor(nops(dg)-2)/2) ; end proc: A055017 := proc(n) sumodigs(n)-sumedigs(n) ; end proc: # R. J. Mathar, Aug 26 2011 PROG (Smalltalk) "Recursive version for general bases" "Set base = 10 for this sequence" altDigitalSumRight: base | s | base = 1 ifTrue: [^self \\ 2]. (s := self // base) > 0   ifTrue: [^(self - (s * base) - (s altDigitalSumRight: base))]   ifFalse: [^self] [by Hieronymus Fischer, Mar 23 2014] CROSSREFS Cf. A225693 (alternating sum of digits). Unsigned version differs from A040114 and A040115 when n=100 and from A040997 when n=101. Cf. A076313, A076314, A007953, A003132. Cf. A004086. Sequence in context: A274580 A241494 A076313 * A225693 A040997 A256851 Adjacent sequences:  A055014 A055015 A055016 * A055018 A055019 A055020 KEYWORD base,easy,sign AUTHOR Henry Bottomley, May 31 2000 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified December 15 00:30 EST 2019. Contains 329988 sequences. (Running on oeis4.)