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

A287994 Position of the first time an n-digit number appears twice in a row after the decimal point of Pi.

Original entry on oeis.org

24, 413, 326, 8239, 107472, 1632152, 9719518, 106235025
Offset: 1

Views

Author

Bobby Jacobs, Sep 01 2017

Keywords

Comments

209209 and 305305 appear in Pi before any 2-digit number appears twice in a row.

Examples

			a(1) = 24 because the first time a 1-digit number appears twice in a row in the decimal expansion of Pi is 24 digits after the decimal point: 3.14159265358979323846264(33)...
		

Crossrefs

Programs

  • Mathematica
    s = First@ RealDigits[Pi,10,10^7]; Table[p = Partition[s,k,1];
    SelectFirst[ Range[ Length[p] - k], p[[#]] == p[[# + k]] &] - 1, {k, 7}] (* Giovanni Resta, Sep 05 2017 *)
  • Python
    from sympy import S
    # download https://stuff.mit.edu/afs/sipb/contrib/pi/pi-billion.txt, then
    # with open('pi-billion.txt', 'r') as f: pi_digits = f.readline()
    pi_digits = str(S.Pi.n(2*10**5))[:-1] # alternative to above
    pi_digits = pi_digits.replace(".", "")
    def a(n):
        idx = 1
        while pi_digits[idx:idx+n] != pi_digits[idx+n:idx+2*n]:
            idx += 1
            assert idx + 2*n < len(pi_digits), "increase precision"
        return idx
    print([a(n) for n in range(1, 6)]) # Michael S. Branicky, Apr 24 2022

Extensions

a(8) from Michael S. Branicky, Apr 24 2022

A290984 First n-digit number to appear twice in a row in the decimal expansion of e.

Original entry on oeis.org

6, 95, 427, 1828, 34619, 507629, 7342911, 21958718, 852480872
Offset: 1

Views

Author

Bobby Jacobs, Aug 16 2017

Keywords

Comments

18281828 appears in e before any 1-digit, 2-digit, or 3-digit number appears twice in a row.
a(n) starts at positions 31, 49, 97, 2, 112869, 5005575, 1561314, 69682897, ... - Bobby Jacobs, Sep 05 2017

Examples

			a(1) = 6 because 6 is the first 1-digit number to appear twice in a row in the decimal expansion of e = 2.718281828459045235360287471352(66)...
		

Crossrefs

Programs

  • Mathematica
    With[{s = Rest@ First@ RealDigits[N[E, 10^5]]}, Keys@ Merge[#, Identity] &@ Table[TakeSmallest[#, 1] &@ Sort[Map[#[[1, 1]] &, DeleteCases[#, {}]]] &@ Map[SequenceCases[#, {a_, b_} /; b == a + n] &, KeyMap[FromDigits, PositionIndex@ Partition[s, n, 1]]], {n, 4}]] (* Michael De Vlieger, Aug 16 2017 *)
    (* or *)
    s = First@ RealDigits[E,10,51*^5]; Table[p = Partition[s, k, 1]; FromDigits @@ p[[ Select[ Range[ Length@p - k], p[[#]] == p[[#+k]] &, 1]]], {k, 7}] (* much faster, Giovanni Resta, Sep 05 2017 *)

Extensions

a(6)-a(8) from Giovanni Resta, Sep 05 2017
a(9) from Michael S. Branicky, Jan 20 2023
Showing 1-2 of 2 results.