login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 


a(n+1) = abs[ a(n) + (-1)^(n+1) * Sum_of_digits_of(n+1)], with a(0)=0.
1

%I #10 Jan 04 2019 13:17:04

%S 0,1,3,0,4,1,7,0,8,1,2,0,3,1,6,0,7,1,10,0,2,1,5,0,6,1,9,0,10,1,4,0,5,

%T 1,8,0,9,1,12,0,4,1,7,0,8,1,11,0,12,1,6,0,7,1,10,0,11,1,14,0,6,1,9,0,

%U 10,1,13,0,14,1,8,0,9,1,12,0,13,1,16,0,8,1,11,0,12,1,15,0,16,1,10,0,11,1,14

%N a(n+1) = abs[ a(n) + (-1)^(n+1) * Sum_of_digits_of(n+1)], with a(0)=0.

%C a(4*k)=0, with k>=1

%C a(4*k-2)=1, with k>=1

%H Harvey P. Dale, <a href="/A138376/b138376.txt">Table of n, a(n) for n = 0..1000</a>

%p P:=proc(n) local a,i,k,w; a:=0; print(a); for i from 1 by 1 to n do w:=0; k:=i; while k>0 do w:=w+k-(trunc(k/10)*10); k:=trunc(k/10); od; a:=abs(a+(-1)^i*w); print(a); od; end: P(100);

%t nxt[{n_,a_}]:={n+1,Abs[a+(-1)^(n+1) Total[IntegerDigits[n+1]]]}; NestList[nxt,{0,0},100][[All,2]] (* _Harvey P. Dale_, Jan 04 2019 *)

%Y Cf. A037123.

%K easy,nonn,base

%O 0,3

%A _Paolo P. Lava_ and _Giorgio Balzarotti_, May 08 2008

%E Definition corrected by _N. J. A. Sloane_, Jan 04 2019

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 20 13:10 EDT 2024. Contains 376072 sequences. (Running on oeis4.)