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

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

A360503 Numbers k such that A048435(k) is prime.

Original entry on oeis.org

2, 5, 82, 2546
Offset: 1

Views

Author

N. J. A. Sloane, Feb 17 2023

Keywords

Comments

a(1), a(2), and a(3) were found by Kurt Foster, Oct 24 2015 (see A048435). a(4) was found by Jeff Peltier: see comments following the "Most Wanted Prime" video.

Crossrefs

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

A360504 Concatenate the ternary strings for 1,2,...,n-1, n, n-1, ..., 2,1.

Original entry on oeis.org

1, 121, 121021, 1210111021, 12101112111021, 121011122012111021, 1210111220212012111021, 12101112202122212012111021, 1210111220212210022212012111021, 1210111220212210010110022212012111021, 1210111220212210010110210110022212012111021, 1210111220212210010110211010210110022212012111021
Offset: 1

Views

Author

N. J. A. Sloane, Feb 17 2023

Keywords

Comments

If the terms are read as ternary strings and converted to base 10, we get A260853. For example, a(3) = 121021_3 = 439_10, which is A260853(3). This is a prime. What is the next prime term?
If the terms are read as decimal numbers, which of them are primes? a(3) = 121021_10 is a decimal prime, but what is the next one? It is a surprise that 121021 is a prime in both base 3 and base 10.

Examples

			To get a(3) we concatenate 1, 2, 10, 2, and 1, getting 121021.
		

Crossrefs

This is the ternary analog of A173426.

Programs

  • Maple
    t:= n-> (l-> parse(cat(seq(l[-i], i=1..nops(l)))))(convert(n, base, 3)):
    a:= n-> parse(cat(map(t, [$1..n, n-i$i=1..n-1])[])):
    seq(a(n), n=1..12);  # Alois P. Heinz, Feb 17 2023
  • Mathematica
    Table[FromDigits[Flatten[Join[IntegerDigits[#,3]&/@Range[n],IntegerDigits[#,3]&/@ Range[ n-1,1,-1]]]],{n,20}] (* Harvey P. Dale, Oct 01 2023 *)
  • Python
    from sympy.ntheory import digits
    def a(n): return int("".join("".join(map(str, digits(k, 3)[1:])) for k in list(range(1, n+1))+list(range(n-1, 0, -1))))
    print([a(n) for n in range(1, 16)]) # Michael S. Branicky, Feb 18 2023
    
  • Python
    # faster version for initial segment of sequence
    from sympy.ntheory import digits
    from itertools import count, islice
    def agen(): # generator of terms
        sf, sr = "", ""
        for n in count(1):
            sn = "".join(map(str, digits(n, 3)[1:]))
            sf += sn
            yield int(sf + sr)
            sr = sn + sr
    print(list(islice(agen(), 15))) # Michael S. Branicky, Feb 18 2023

A360506 Read A360505(n) as if it were a base-3 string and write it in base 10.

Original entry on oeis.org

1, 7, 34, 358, 4003, 43369, 456712, 4708240, 47754961, 1339156591, 39693785002, 1169411930926, 34213667699203, 995038950807565, 28790341783585180, 829295063367580492, 23793774263808446005, 680307709052882601259, 19390954850541496025998
Offset: 1

Views

Author

N. J. A. Sloane, Feb 17 2023

Keywords

Comments

This has the same relationship to A360505 as A048435 does to A360502.
The primes in A048435 are in A360503. What are the primes in the present sequence?
Answer: The first primes are a(2) = 7, a(5) = 4003, a(13) = 34213667699203, a(57) and a(109). See A360507. - Rémy Sigrist, Feb 18 2023

Examples

			A360505(4) = 111021 and 111021_3 = 358_10 = a(4).
		

Crossrefs

Programs

  • PARI
    a(n) = fromdigits(concat([digits(k, 3) | k <- Vecrev([1..n])]), 3) \\ Rémy Sigrist, Feb 18 2023
    
  • Python
    from sympy.ntheory import digits
    def a(n): return int("".join("".join(map(str, digits(k, 3)[1:])) for k in range(n, 0, -1)), 3)
    print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Feb 19 2023
    
  • Python
    # faster version for initial segment of sequence
    from sympy.ntheory import digits
    from itertools import count, islice
    def agen(s=""): yield from (int(s:="".join(map(str, digits(n, 3)[1:]))+s, 3) for n in count(1))
    print(list(islice(agen(), 20))) # Michael S. Branicky, Feb 19 2023
    
  • Python
    from itertools import count, islice
    def A360506_gen(): # generator of terms
        a, b, c = 3, 1, 0
        for i in count(1):
            if i >= a:
                a *= 3
            c += i*b
            yield c
            b *= a
    A360506_list = list(islice(A360506_gen(),30)) # Chai Wah Wu, Nov 08 2023

Formula

a(n) = A028898(A360505(n)). - Rémy Sigrist, Feb 18 2023

Extensions

More terms from Rémy Sigrist, Feb 18 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

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)))

A360505 Concatenate the ternary strings for n, n-1, n-2, ..., 2, 1.

Original entry on oeis.org

1, 21, 1021, 111021, 12111021, 2012111021, 212012111021, 22212012111021, 10022212012111021, 10110022212012111021, 10210110022212012111021, 11010210110022212012111021, 11111010210110022212012111021, 11211111010210110022212012111021, 12011211111010210110022212012111021
Offset: 1

Views

Author

N. J. A. Sloane, Feb 17 2023

Keywords

Comments

Similar to A360502, but here we count down from n to 1 in base 3 and concatenate the strings to get a(n).
This is the ternary analog of A000422.

Crossrefs

Programs

  • Mathematica
    a[n_] := FromDigits @ Flatten @ IntegerDigits[Range[n, 1, -1], 3]; Array[a, 15] (* Amiram Eldar, Feb 18 2023 *)
  • PARI
    a(n) = strjoin(concat([digits(k, 3) | k <- Vecrev([1..n])])) \\ Rémy Sigrist, Feb 18 2023
    
  • Python
    from sympy.ntheory import digits
    def a(n): return int("".join("".join(map(str, digits(k, 3)[1:])) for k in range(n, 0, -1)))
    print([a(n) for n in range(1, 16)]) # Michael S. Branicky, Feb 18 2023
    
  • Python
    # faster version for initial segment of sequence
    from sympy.ntheory import digits
    from itertools import count, islice
    def agen(s=""): yield from (int(s:="".join(map(str, digits(n, 3)[1:]))+s) for n in count(1))
    print(list(islice(agen(), 15))) # Michael S. Branicky, Feb 18 2023
Showing 1-9 of 9 results.