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.
%I A256851 #16 Mar 01 2025 22:49:27 %S A256851 1,2,3,4,5,6,7,8,9,-1,0,-1,-4,-3,-6,-5,-8,-7,-10,2,-1,0,5,2,7,4,9,6, %T A256851 11,-3,2,-5,0,-1,-8,-3,-10,-5,-12,4,-3,6,-1,0,9,2,11,4,13,-5,4,-7,2, %U A256851 -9,0,-1,-12,-3,-14,6,-5,8,-3,10,-1,0,13,2,15,-7,6,-9,4,-11,2,-13,0,-1,-16,8,-7,10,-5,12,-3,14,-1,0,17,-9,8,-11,6,-13,4,-15 %N A256851 First-order differences for the cumulative sum of the digits of the integers when alternately adding and subtracting each digit of a particular value. %C A256851 The sequence was suggested by _Wolfdieter Lang_ and represents a(n) - a(n-1) for the sequence A256379, which alternately adds and subtracts each digit of a particular value in the integers. %H A256851 Anthony Sand, <a href="/A256851/b256851.txt">Table of n, a(n) for n = 1..1000</a> %F A256851 a(n) = Sum_{m=1..r(n)} (-1)^(a(n,m) + 1)*digit(n,m), where a(n,m) = A256100(n,m) read as an array with row length r(n) (number of digits of n), and digit(n,m) is the m-th digit of n (see the formula for A256379). - _Wolfdieter Lang_, Apr 15 2015 %e A256851 a(0) = 0, therefore a(1) - a(0) = 1 - 0 = 1. %e A256851 For n = 1..9, the function is encountering each digit for the first time, therefore a(9) = 45. %e A256851 For n = 10, the function encounters the digit 1 for the second time and subtracts it. Therefore a(10) = 44 and a(10) - a(9) = -1. %o A256851 (PARI) { nmx=1000; b=10; dig=vector(b); si=0; for(i=1,b,dig[i]=1); n=0; s=0; while(n<nmx, n++; d=digits(n,b); prev=s; for(i=1,#d, s+=d[i]*dig[d[i]+1]; dig[d[i]+1]*=-1; ); print1(s-prev); if(n<nmx,print1(", ")); ); } %Y A256851 Cf. A167232, A037123, A256379. %K A256851 sign,base,easy %O A256851 1,2 %A A256851 _Anthony Sand_, Apr 11 2015