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

A030304 Least k such that the base-2 representation of n begins at s(k), where s=A030190 (or equally A030302).

Original entry on oeis.org

0, 1, 2, 1, 6, 2, 1, 4, 18, 6, 26, 2, 5, 1, 4, 15, 50, 18, 6, 22, 63, 26, 77, 2, 17, 5, 25, 1, 4, 11, 15, 46, 130, 50, 18, 55, 154, 6, 22, 65, 146, 63, 26, 28, 163, 77, 2, 13, 49, 17, 5, 34, 69, 25, 79, 1, 16, 4, 68, 11, 15, 41, 46, 125, 322, 130, 50
Offset: 0

Views

Author

Keywords

Crossrefs

Cf. A030190, A030302, A031297 (decimal variant), A055143.

Programs

  • Mathematica
    nmax = 100;
    s = Table[IntegerDigits[n, 2], {n, 0, nmax}] // Flatten;
    a[n_] := SequencePosition[s, IntegerDigits[n, 2], 1][[1, 1]] - 1;
    a /@ Range[0, nmax] (* Jean-François Alcover, Feb 21 2021 *)
  • Perl
    $bb = ""; foreach $n (0..66) { print index($bb .= $b = sprintf("%b", $n), $b), ", "; } # Rémy Sigrist, Aug 19 2020
    
  • Python
    from itertools import count, islice
    def agen():
        k, chap = 0, "0"
        for n in count(0):
            target = bin(n)[2:]
            while chap.find(target) == -1: k += 1; chap += bin(k)[2:]
            yield chap.find(target)
    print(list(islice(agen(), 70))) # Michael S. Branicky, Oct 06 2022

Formula

a(n) = 1 iff n belongs to A055143. - Rémy Sigrist, Feb 20 2021

Extensions

Minor edits by N. J. A. Sloane, Dec 16 2017

A165449 Write the prime numbers in a string: 2357111317192329... (cf. A033308). The sequence gives the first position in the string for natural numbers.

Original entry on oeis.org

5, 1, 2, 21, 3, 31, 4, 41, 12, 47, 5, 62, 7, 22, 77, 32, 9, 95, 11, 589, 110, 113, 1, 128, 131, 137, 63, 149, 15, 158, 8, 14, 123, 24, 2, 188, 19, 42, 72, 206, 21, 215, 23, 227, 233, 236, 25, 248, 75, 257, 78, 263, 27, 269, 275, 278, 3, 290, 29, 299, 31, 829
Offset: 1

Views

Author

Rémy Sigrist, Sep 20 2009

Keywords

Comments

Same as A229190 but omitting the a(0) term.
Defined for all a by the normality of the Copeland-Erdős constant. - Aaron Weiner, Sep 19 2013

Examples

			The first occurrence of "111" in the string is 5, so a(111)=5.
		

Crossrefs

Cf. A229190 (same sequence but including the a(0) term).
Cf. A031297.

Programs

  • Maple
    with(StringTools): s:="": for n from 1 to 300 do s:=cat(s,convert(ithprime(n),string)): od: seq(Search(convert(n,string),s),n=1..62); # Nathaniel Johnston, May 26 2011
  • Mathematica
    With[{prd=Flatten[IntegerDigits/@Prime[Range[1000]]],nn=10},Flatten[ Table[ SequencePosition[ prd,IntegerDigits[ n],1],{n,70}],1]][[All,1]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, May 12 2019 *)
  • Python
    from sympy import primerange
    from itertools import count, takewhile
    def afind(plimit):
      s = "".join(str(p) for p in primerange(1, plimit+1))
      return [1+s.find(str(n)) for n in takewhile(lambda i: str(i) in s, count(1))]
    print(afind(10**4)) # Michael S. Branicky, May 01 2021

A229186 Beginning position of n in the decimal expansion of the Champernowne constant.

Original entry on oeis.org

11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 1, 16, 18, 20, 22, 24, 26, 28, 30, 15, 34, 2, 38, 40, 42, 44, 46, 48, 50, 17, 37, 56, 3, 60, 62, 64, 66, 68, 70, 19, 39, 59, 78, 4, 82, 84, 86, 88, 90, 21, 41, 61, 81, 100, 5, 104, 106, 108, 110, 23
Offset: 0

Views

Author

Eric W. Weisstein, Sep 15 2013

Keywords

Comments

Ignoring the initial 0 to the left of the decimal point.
Same as A031297 but including the a(0) term.

Crossrefs

Cf. A033307 (decimal expansion of the Champernowne constant).
Cf. A072290 (number of digits in the decimal expansion of the Champernowne constant that must be scanned to encounter all n-digit strings).
Cf. A031297 (same sequence but omitting the a(0) term).

Programs

  • Python
    from itertools import count, islice
    def agen():
        k, chap = 1, ".1"
        for n in count(0):
            target = str(n)
            while chap.find(target) == -1: k += 1; chap += str(k)
            yield chap.find(target)
    print(list(islice(agen(), 70))) # Michael S. Branicky, Oct 06 2022

A290647 a(n) is the position of first occurrence of n^2 in the concatenation of the positive integers in decimal representation.

Original entry on oeis.org

1, 4, 9, 22, 40, 62, 88, 83, 27, 190, 14, 322, 397, 478, 565, 658, 757, 37, 299, 1090, 323, 86, 777, 141, 660, 124, 783, 1325, 443, 2590, 479, 2986, 3246, 3514, 3790, 4074, 4366, 4666, 346, 5290, 394, 5946, 6286, 6634, 6990, 3541, 7261, 8106, 3851, 8890, 3931, 9706, 10126, 5408, 9012, 4345, 8865, 981, 4283, 13290, 4379
Offset: 1

Views

Author

Zhining Yang, Aug 08 2017

Keywords

Examples

			s = 123456789101112131415161718192021222324252627282930313233343536... .
a(4) = 22 because the first occurrence of 4^2 = 16 in s starts at the 22nd digit.
		

Crossrefs

Programs

  • Mathematica
    t = ""; k = 0; Table[ While[(z = StringPosition[t, ToString[n^2], 1]) == {}, t = t <> ToString[++k]]; z[[1, 1]], {n, 61}] (* Giovanni Resta, Aug 11 2017 *)
    Module[{nn=15000,s},s=Flatten[IntegerDigits/@Range[nn]];Flatten[Table[ SequencePosition[s,IntegerDigits[n^2],1],{n,70}],1]][[All,1]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jul 05 2021 *)
  • VBA
    Sub test()
    Dim i&, t$
    For i = 1 To 10000
    t = t & i
    Next
    For i = 1 To 100
    Debug.Print InStr(t, i ^ 2); ",";
    Next
    End Sub

A290787 a(n) is the position of the first occurrence of n^3 in the concatenation of the positive integers in decimal representation.

Original entry on oeis.org

1, 8, 44, 83, 265, 378, 58, 267, 783, 2890, 289, 5802, 6781, 9866, 12390, 15274, 4288, 9223, 22764, 30890, 6595, 42130, 49725, 58010, 1575, 76770, 87305, 7670, 110835, 123890, 53786, 127309, 168575, 11048, 10389, 1884, 164216, 116326, 86857, 188924, 73351, 15241, 30690, 81318, 45139, 157378, 511828, 41849, 594784, 638890
Offset: 1

Views

Author

Zhining Yang, Aug 10 2017

Keywords

Examples

			3^3 = 27, so a(3) = 44 because the digit string "27" first occurs beginning at the 44th digit of the string
  s = "12345678910111213141516171819202122232425262728...":
.
.                  1         2         3         4
Position: 12345678901234567890123456789012345678901234567...
                                                     vv
       s: 12345678910111213141516171819202122232425262728...
                                                     ^^
		

Crossrefs

Programs

  • Mathematica
    T = StringJoin @@ ToString /@ Range@ 700000; Table[StringPosition[T, ToString[ n^3], 1][[1, 1]], {n, 50}] (* Giovanni Resta, Aug 11 2017 *)
  • VBA
    Sub test()
    Dim i&, t$, s$(1 To 125000)
    For i = 1 To 125000
    s(i) = i
    Next
    t = Join(s, "")
    For i = 1 To 50
    Debug.Print InStr(t, i ^ 3); ",";
    Next
    End Sub

A181362 a(n) is the starting position of the n-th occurrence of n in the string 123456789101112131415161718192021... .

Original entry on oeis.org

1, 15, 37, 59, 81, 103, 125, 147, 169, 214, 235, 271, 307, 533, 836, 1139, 1442, 1745, 2048, 2651, 541, 708, 978, 1308, 1608, 1908, 2208, 2508, 2808, 4115, 2684, 3020, 3424, 3428, 4232, 4331, 4375, 4419, 4463, 6652, 3229, 4595, 4639, 4679, 4719, 4767
Offset: 1

Views

Author

Jon Palin (jon.palin(AT)gmail.com), Oct 15 2010

Keywords

Crossrefs

Cf. A033307, A031297 (first occurrence).

Programs

  • Maple
    M:= 10000: S:= cat(seq(i,i=1..M)):
    f:= proc(n) local i,R; global S, M;
       R:= [StringTools:-SearchAll(sprintf("%d",n),S)];
       while nops(R) < n do
           S:= cat(S, seq(i,i=M+1..2*M));
           M:= 2*M;
           R:= [StringTools:-SearchAll(sprintf("%d",n),S)];
       od;
       R[n]
    end proc:
    map(f, [$1..100]); # Robert Israel, Jul 31 2025
  • Python
    def a(n):
        # a(n) is the starting position of the n-th occurrence of n in
        # the string 123456789101112131415161718192021    .
        full='~'+''.join(map(str,range(1,10000)))
        def place(n,str_n,offset):
            p=full[offset:].find(str_n)+offset
            return p if n==1 else place(n-1,str_n,p+1)
        return place(n,str(n),0)
    # prints the first fifty terms
    print(', '.join(str(a(i)) for i in range(1,51)))
Showing 1-6 of 6 results.