A196686 Number of odd digits of Pi minus number of even digits.
1, 2, 1, 2, 3, 4, 3, 2, 3, 4, 5, 4, 5, 6, 7, 8, 7, 8, 7, 6, 5, 4, 3, 2, 3, 4, 3, 4, 3, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, 10, 11, 12, 11, 12, 11, 10, 9, 10, 11, 10, 11, 10, 9, 10, 11, 10, 11, 10, 11, 10, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 2, 1, 0, -1, -2, -1, -2, -3, -4, -3, -2, -3, -4, -3, -2
Offset: 1
Examples
Among first 10 digits of Pi, {3,1,4,1,5,9,2,6,5,3}, there are 7 odd and 3 even, hence a(10)=7-3=4.
Links
- Zak Seidov, Table of n, a(n) for n = 1..10000 [a(10000) corrected by _Georg Fischer_, Dec 29 2021]
- Zak Seidov, Dependence a(n) for n = 1..10000
- Zak Seidov, Dependence a(n) for n = 1..10^6
Programs
-
Mathematica
rd=RealDigits[N[Pi, 10004]][[1]]; a=0; s=Reap[Do[a=a+2Mod[rd[[n]],2]-1; Sow[{n,a}], {n,10004}]][[2,1]] (* this gives b-file *) (* Zak Seidov, Oct 05 2011 *) Module[{nn=100,pid},pid=RealDigits[Pi,10,nn][[1]];Accumulate[If[OddQ[#],1,-1]&/@pid]] (* Harvey P. Dale, Feb 23 2025 *)
Extensions
Definition amended by Georg Fischer, Dec 29 2021
Comments