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-3 of 3 results.

A175792 a(n) = Sum_{k=1..n} (-1)^A000796(k), excess of the number of even over odd digits in the first n digits of Pi.

Original entry on oeis.org

-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
Offset: 1

Views

Author

Michel Lagneau, Sep 06 2010

Keywords

Examples

			a(6) = (-1)^3 + (-1)^1 + (-1)^4 + (-1)^1 + (-1)^5 + (-1)^9= -4.
		

Crossrefs

cf. A000796, A030657, A196686 (negated), A175813 (indices of 0's).

Programs

  • Maple
    Digits := 100:
    A000796 := proc(n)
            floor(Pi*10^(n-1)) mod 10;
    end proc:
    A175792 := proc(n)
            add((-1)^A000796(k),k=1..n) ;
    end proc: # R. J. Mathar, Jul 10 2012
  • Mathematica
    Rest@ FoldList[ Plus, 0, (-1)^First@ RealDigits[Pi, 10, 200]]
    Accumulate[Table[If[EvenQ[n],1,-1],{n,RealDigits[Pi,10,70][[1]]}]] (* Harvey P. Dale, Nov 03 2015 *)

A196686 Number of odd digits of Pi minus number of even digits.

Original entry on oeis.org

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

Views

Author

Zak Seidov, Oct 05 2011

Keywords

Comments

Cumulative sum of A030657 with zeros replaced by "-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.
		

Crossrefs

Cf. A030657, A175792 (negated), A175813 (indices of 0's).

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

A383690 Positions of digits in the decimal expansion of Pi where the cumulative sum of even digits equals the cumulative sum of odd digits (positions 1, 2, 3, ... refer to the digits 3, 1, 4, ...).

Original entry on oeis.org

3, 268, 375, 376, 402
Offset: 1

Views

Author

Gonzalo Martínez, May 09 2025

Keywords

Comments

Sequence is likely finite and 402 is likely the last term. If each digit in the decimal expansion of Pi appears with the same frequency and since the sum of the odd digits is 25 and the sum of the even digits is 20, then the difference between the cumulative sum of the odd digits and the cumulative sum of the even digits tends to be positive.
Sequence inspired by the discussion of Michael S. Branicky, Jinyuan Wang and David A. Corneth.

Examples

			3 is in this sequence because when considering the first 3 decimal places in the decimal expansion of Pi, which are 3, 1 and 4, it is satisfied that 3 + 1 = 4.
		

Crossrefs

Cf. A000796, A175813 (equal counts instead of equal sums).

Programs

  • Mathematica
    p = RealDigits[Pi, 10, 10^4][[1]]; Flatten@ Position[ Accumulate[(-1)^p p], 0] (* Giovanni Resta, May 10 2025 *)
Showing 1-3 of 3 results.