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-10 of 11 results. Next

A297824 The number of iterations to remove all runs from the binary string 11011100...n (formed by concatenating the first n binary numbers, see A058935(n)).

Original entry on oeis.org

0, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 9, 10, 10, 10, 10, 10, 10, 9, 8, 8, 10, 7, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 10, 9, 10, 9, 10, 10, 8, 9, 9, 10, 10, 9, 7, 9, 10, 10, 10, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
Offset: 1

Views

Author

Rick L. Shepherd, Jan 06 2018

Keywords

Comments

Each iteration removes all runs of two or more identical bits that appear at the beginning of that iteration. By definition, the bits of the final string will be an initial segment, possibly empty, of 0, 1, 0, 1, ... (A000035) or 1, 0, 1, 0, ... (A059841). A297825 gives the lengths of the final strings; the sign of each nonzero term indicates which case occurs.

Examples

			a(21) = 6 because 1101110010111011110001001101010111100110111101111100001000110010100111010010101 --> 01001010100011010110101 --> 01101010100101 --> 0010101101 -->  101001 --> 1011 --> 10, where each arrow points to the result of one iteration.
		

Crossrefs

Programs

  • PARI
    {remove_runs(v) = my(w, run_found = 0);
    if(#v == 1, w = v, w = []);
    for(k = 2, #v,
       if(v[k-1] == v[k],
         run_found = 1,
         if(run_found == 0, w = concat(w, v[k-1]), run_found = 0);
         if(k == #v, w = concat(w, v[k]))
       )
    ); w}
    {a(n) = my(v = [], L,  c = 0); \\ remove "write(...);" if don't need other b-file
    for(k = 1, n, v = concat(v, binary(k)));
    L = #v;
    while(1,
      v = remove_runs(v);
      if(#v == L, write("b297825.txt", n, " ", L*(if(L == 0, 0, 2*v[1] - 1))); break, L = #v);
      c++
    ); c}
    for(n = 1, 10000, write("b297824.txt", n, " ", a(n))) \\ created two b-files

A297825 a(n) is the (negative) length of the final string after iteratively removing all runs from the binary string 11011100...n (formed by concatenating the first n binary numbers, see A058935(n)).

Original entry on oeis.org

1, -1, -1, -1, -4, -2, -2, -2, -2, 2, 4, 4, 2, 3, 3, 3, 3, 4, 5, 7, 2, 4, 6, 6, 7, 6, 5, 5, 5, 5, 5, 5, 5, 6, 7, 6, 4, 6, 7, 9, 7, 1, -3, -2, -1, -1, 0, 0, 1, 2, 2, 0, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 2, 1, 1, -2, 0, 1, 3, 1, 0, -2, -6, 1, -2, -5, -4, -4, -3, -4, -4, -3, -3, -3, -3, -4, -5, -5, -6
Offset: 1

Views

Author

Rick L. Shepherd, Jan 07 2018

Keywords

Comments

There are exactly three cases: The final string may have length zero, in which case a(n) = 0. If the final string begins 0101... (bits are an initial segment of A000035), a(n) is negative. Otherwise, the final string begins 1010... (bits are an initial segment of A059841) and a(n) is positive. Thus |a(n)| always gives the actual string length (number of terms in the segment).
Of interest is the frequency of sign changes and 0 terms as n becomes large. The largest values of n in the current b-file such that a(n) = 0 are 8612 and 9899.

Examples

			a(21) = 2 because the final string after iteratively removing all runs of two or more identical bits from 11011100...10101 is 10 of length two (as shown in the A297824 example). This term is positive because the first bit of 10 is 1.
		

Crossrefs

Programs

  • PARI
    \\ See the program given in A297824.

A117640 Concatenation of first n numbers in base 4.

Original entry on oeis.org

1, 12, 123, 12310, 1231011, 123101112, 12310111213, 1231011121320, 123101112132021, 12310111213202122, 1231011121320212223, 123101112132021222330, 12310111213202122233031
Offset: 1

Views

Author

Jonathan Vos Post, Apr 27 2006

Keywords

Comments

Concatenation of the first n terms of A007090.
Base-4 analog of A058935.

Crossrefs

Other bases: A058935 (2), A360502 (3), A007908 (10).

Programs

  • Mathematica
    Table[FromDigits[Flatten[Table[IntegerDigits[n,4],{n,k}]]],{k,15}] (* Harvey P. Dale, Jan 18 2023 *)
  • Python
    from gmpy2 import digits
    def A117640(n): return int(''.join(digits(n,4) for n in range(1,n+1))) # Chai Wah Wu, Apr 19 2023

Extensions

Edited by Jason Kimberley, Nov 27 2012

A362118 a(n) = (10^(n*(n+1)/2)-1)/9.

Original entry on oeis.org

1, 111, 111111, 1111111111, 111111111111111, 111111111111111111111, 1111111111111111111111111111, 111111111111111111111111111111111111, 111111111111111111111111111111111111111111111, 1111111111111111111111111111111111111111111111111111111, 111111111111111111111111111111111111111111111111111111111111111111
Offset: 1

Views

Author

Keywords

Comments

Concatenate 1, 11, 111, ..., 11...1 (n ones). There are n*(n+1)/2 1's in a(n).
This is a kind of unary analog of A058935, A360502, A117640, etc.
When regarded as decimal numbers, which (if any) is the smallest prime?
Answer: All terms > 1 are composite, since 111 is composite, all triangular numbers > 3 are composite and a prime repunit must have a prime number of decimal digits (see A004023). - Chai Wah Wu, Apr 19 2023. [This result was independently obtained by Michael S. Branicky, see A362429. - N. J. A. Sloane, Apr 20 2023]
a(45) has more than 1000 digits, and so cannot be included in the b-file. - Jason Bard, Apr 12 2025

Examples

			a(3) = 111111 because 3(3+1)/2 = 6, and 111111 has 6 ones.
		

Crossrefs

Programs

Formula

a(n) = A000042(A000217(n)). - Jason Bard, Apr 12 2025

A117127 Concatenate the first n positive integers written in binary (with each integer written so the most significant 1 is on the left and the concatenated string is from left to right). a(n) is the number of times n written in binary appears in the concatenated string.

Original entry on oeis.org

1, 1, 2, 1, 2, 3, 3, 1, 2, 1, 4, 3, 4, 5, 4, 1, 2, 2, 3, 2, 3, 2, 7, 3, 4, 4, 6, 6, 5, 7, 5, 1, 2, 2, 3, 1, 4, 3, 4, 2, 4, 2, 5, 2, 4, 4, 9, 3, 4, 5, 5, 4, 6, 4, 9, 6, 6, 6, 7, 9, 6, 9, 6, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 5, 2, 6, 4, 5, 2, 4, 3, 6, 3, 5, 4, 7, 2, 5, 4, 7, 3, 7, 5, 11, 3, 4, 5, 5, 4, 7, 5, 7, 4
Offset: 1

Views

Author

Leroy Quet, Apr 20 2006

Keywords

Comments

See also A047778, concatenation of first n numbers in binary. - Jonathan Vos Post, Apr 21 2006
Note that these counts reflect the pattern overlapping case. - Diana L. Mecum, Aug 06 2008
First occurrence of n: 1, 3, 6, 11, 14, 27, 23, 107, 47, 119, 95, 111, 191, 239, 223, 1007, 767, 447, 1535, 991, 895, 959, 3519, 1791, 1983, 1919, 3583, 7159, 7871, 3839, 14327, 16063, 8063, 7679, 7935, 15839, ??, 15359, 16127, 15871, ..., ; limit of search = 25000. - Robert G. Wilson v, Aug 30 2008

Examples

			The first 13 positive integers written in binary and concatenated is
11011100101110111100010011010101111001101.
13 in binary, which is 1101, appears 4 times in the concatenated string, starting at positions (reading from left to right) 1, 12, 25 and 38.
The last occurrence of 1101 is the integer 13 itself converted to binary and added to the end of the concatenated string, of course. So a(13) = 4.
		

Crossrefs

Programs

  • Maple
    A007088 := proc(n) convert(n,base,2) ; ListTools[Reverse](%) ; end:
    A058935 := proc(n) local i,a ; if n = 0 then RETURN([0]) ; else a := [] ; for i from 1 to n do a := [op(a),op(A007088(i))] ; od: fi ; end:
    A117127 := proc(n) local a058935,strtL,endL,nL,a ; nL := A007088(n) ; a058935 := A058935(n) ; a := 0 ; for strtL from 1 to nops(a058935) do for endL from strtL to nops(a058935) do if verify[sublist]( nL, [op(strtL..endL, a058935)] ) then a := a+1 ; fi ; od: od ; RETURN(a) ; end: for n from 1 to 80 do printf("%d, ",A117127(n)) ; od: # R. J. Mathar, Jan 23 2008
  • Mathematica
    a[n_] := StringCount[ ToString@ FromDigits@ Flatten@ IntegerDigits[ Range@n, 2], ToString@ FromDigits@ IntegerDigits[n, 2], Overlaps -> True]; Array[a, 105] (* Robert G. Wilson v, Aug 30 2008 *)
    fc[n_]:=Module[{idn2=IntegerDigits[n,2],len},len=Length[idn2];Count[ Partition[ Flatten[Table[IntegerDigits[i,2],{i,n}]],len,1],idn2]]; Array[fc,110] (* Harvey P. Dale, Dec 16 2011 *)

Extensions

More terms from R. J. Mathar, Jan 23 2008
Terms 81 through 2000 from Diana L. Mecum, Aug 06 2008

A300570 a(n) is the concatenation n in base 2, n-1 in base 2, ..., 1 in base 2.

Original entry on oeis.org

1, 101, 11101, 10011101, 10110011101, 11010110011101, 11111010110011101, 100011111010110011101, 1001100011111010110011101, 10101001100011111010110011101, 101110101001100011111010110011101, 1100101110101001100011111010110011101
Offset: 1

Views

Author

Seiichi Manyama, Mar 08 2018

Keywords

Crossrefs

Cf. A098780 (decimal expansion of terms).

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=1, 1,
          parse(cat(convert(n, binary), a(n-1))))
        end:
    seq(a(n), n=1..12);  # Alois P. Heinz, Feb 19 2023
  • Mathematica
    Table[FromDigits[Flatten[IntegerDigits[#,2]&/@Range[n,1,-1]]],{n,20}] (* Harvey P. Dale, Sep 07 2020 *)
  • Python
    from itertools import count, islice
    def agen(): # generator of terms
        s = ""
        for k in count(1):
            s = bin(k)[2:] + s
            yield int(s)
    print(list(islice(agen(), 15))) # Michael S. Branicky, Feb 19 2023
    
  • Python
    from functools import reduce
    def A300570(n): return int(bin(reduce(lambda i,j:(i<Chai Wah Wu, Feb 26 2023

A362117 Concatenation of first n numbers in base 5.

Original entry on oeis.org

1, 12, 123, 1234, 123410, 12341011, 1234101112, 123410111213, 12341011121314, 1234101112131420, 123410111213142021, 12341011121314202122, 1234101112131420212223, 123410111213142021222324, 12341011121314202122232430, 1234101112131420212223243031
Offset: 1

Views

Author

Keywords

Comments

When regarded as decimal numbers, the first prime in this sequence is a(6) = 12341011.
a(8) is also prime and for n <= 2000, a(n) is not prime except for n = 6 or 8. - Chai Wah Wu, Apr 19 2023

Crossrefs

Programs

  • Mathematica
    A362117[n_]:=FromDigits[Flatten[IntegerDigits[Range[n],5]]];Array[A362117,20] (* Paolo Xausa, Nov 27 2023 *)
  • Python
    from gmpy2 import digits
    def A362117(n): return int(''.join(digits(n,5) for n in range(1,n+1))) # Chai Wah Wu, Apr 19 2023

A300571 a(n) is the concatenation n in base 2, n-1 in base 2, ..., 0 in base 2.

Original entry on oeis.org

0, 10, 1010, 111010, 100111010, 101100111010, 110101100111010, 111110101100111010, 1000111110101100111010, 10011000111110101100111010, 101010011000111110101100111010, 1011101010011000111110101100111010, 11001011101010011000111110101100111010
Offset: 0

Views

Author

Seiichi Manyama, Mar 08 2018

Keywords

Crossrefs

Programs

  • Python
    from functools import reduce
    def A300571(n): return int(bin(reduce(lambda i,j:(i<Chai Wah Wu, Feb 26 2023

Formula

a(n) = A300570(n)*10. - Chai Wah Wu, Feb 26 2023

A362119 Concatenate the base-6 strings for 1,2,...,n.

Original entry on oeis.org

1, 12, 123, 1234, 12345, 1234510, 123451011, 12345101112, 1234510111213, 123451011121314, 12345101112131415, 1234510111213141520, 123451011121314152021, 12345101112131415202122, 1234510111213141520212223, 123451011121314152021222324, 12345101112131415202122232425
Offset: 1

Views

Author

Keywords

Comments

The smallest prime occurs at n = 12891. - Michael S. Branicky, Apr 20 2023
The b-file has only 313 terms, since a(314) has 1001 digits.

Crossrefs

Programs

  • Mathematica
    A362119[n_]:=FromDigits[Flatten[IntegerDigits[Range[n],6]]];Array[A362119,20] (* Paolo Xausa, Nov 27 2023 *)
  • Python
    from sympy.ntheory import digits
    from itertools import count, islice
    def agen(s="", base=6): yield from (int(s:=s+"".join(map(str, digits(n, base)[1:]))) for n in count(1))
    print(list(islice(agen(), 20)))

A362429 Smallest k such that the concatenation of the numbers 123...k in base n is prime when interpreted as a decimal number, or -1 if no such prime exists.

Original entry on oeis.org

-1, 231, 7315, 3241, 6, 12891, 22, 227, 127
Offset: 1

Views

Author

Keywords

Comments

The sequence can be extended to bases larger than 10 by concatenating the decimal equivalents of digits.
a(1) is -1 since no such primes are possible (the sequence in question is A362118). Proof. The number of ones in the resulting repunit is triangular and per A000217, 3 is the only prime triangular number, and per A004023, prime repunits must have prime indices.
If it exists, a(10) would be the index of the first prime in A007908. See A007908 for the latest information about the search for this prime.
a(10), ..., a(14) are respectively ?, 144, 307, ?, 25.
a(10) and a(13) are presently unknown. a(13) > 10000 if it is not -1.

Examples

			a(5) is 6: 12341011 (concatenate 1 though 6 in base 5) is a prime when interpreted as a decimal number.
		

Crossrefs

Sequences of concatenations: A362118 (base 1), A058935 (base 2), A360502 (base 3), A117640 (base 4), A362117 (base 5), A362119 (base 6), A007908 (base 10).
Cf. A376221.

Programs

  • Python
    from gmpy2 import is_prime
    from sympy.ntheory import digits
    from itertools import count, islice
    def c(base, s=""):
        if base == 1: yield from (s:=s+"1"*n for n in count(1))
        else:
            yield from (s:=s+"".join(map(str, digits(n, base)[1:])) for n in count(1))
    def a(n):
        if n == 1: return -1
        return next(k for k, t in enumerate(c(n), 1) if is_prime(int(t)))
Showing 1-10 of 11 results. Next