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.

A048435 Take the first n numbers written in base 3, concatenate them, then convert from base 3 to base 10.

Original entry on oeis.org

1, 5, 48, 436, 3929, 35367, 318310, 2864798, 77349555, 2088437995, 56387825876, 1522471298664, 41106725063941, 1109881576726421, 29966802571613382, 809103669433561330, 21845799074706155927, 589836575017066210047, 15925587525460787671288, 429990863187441267124796
Offset: 1

Views

Author

Patrick De Geest, May 15 1999

Keywords

Comments

The first three primes in this sequence occur for n = 2 (a(2) = 5), n = 5 (a(5) = 3929), and n = 82 (a(82) = 1.1247...*10^140). - Kurt Foster, Oct 24 2015 [Comment added by N. J. A. Sloane, Oct 25 2015]
According to a comment made by Jeff Peltier following the "Most Wanted Prime" video, n = 2546 also gives a prime. See A360503. - N. J. A. Sloane, Feb 17 2023

Examples

			a(6): (1)(2)(10)(11)(12)(20) = 1210111220_3 = 35367.
		

Crossrefs

Primes: A360503.
Concatenation of first n numbers in other bases: 2: A047778, 3: this sequence, 4: A048436, 5: A048437, 6: A048438, 7: A048439, 8: A048440, 9: A048441, 10: A007908, 11: A048442, 12: A048443, 13: A048444, 14: A048445, 15: A048446, 16: A048447.

Programs

  • Magma
    [n eq 1 select 1 else Self(n-1)*3^(1+Ilog(3, n))+n: n in [1..20]]; // Vincenzo Librandi, Dec 30 2012
  • Mathematica
    If[STARTPOINT==1,n={},n=Flatten[IntegerDigits[Range[STARTPOINT-1],3]]]; Table[AppendTo[n,IntegerDigits[w,3]];n=Flatten[n];FromDigits[n,3],{w,STARTPOINT,ENDPOINT}] (* Dylan Hamilton, Aug 09-04 2010 *)
    f[n_]:= FromDigits[Flatten@IntegerDigits[Range@n, 3], 3]; Array[f, 20] (* Vincenzo Librandi, Dec 30 2012 *)

A360502 Concatenate the ternary strings for 1,2,...,n.

Original entry on oeis.org

1, 12, 1210, 121011, 12101112, 1210111220, 121011122021, 12101112202122, 12101112202122100, 12101112202122100101, 12101112202122100101102, 12101112202122100101102110, 12101112202122100101102110111, 12101112202122100101102110111112, 12101112202122100101102110111112120
Offset: 1

Views

Author

N. J. A. Sloane, Feb 16 2023

Keywords

Comments

If the terms are read as ternary strings and converted to base 10, we get A048435. For example, a(2) = 12_3 = 5_10, which is A048435(2). This is a prime, and gives the first term of A360503.
If the terms are read as decimal numbers, which of them are primes? 12101112202122100101102110111, for example, is not a prime, since it is 37*327057086543840543273030003.
When read as decimal numbers, the first prime is a(7315), with 56003 digits. - Michael S. Branicky, Apr 18 2023

Examples

			a(4): concatenate 1, 2, 10, 11, getting 121011.
		

Crossrefs

This is the ternary analog of A007908.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=0, 0, (l-> parse(cat(
          a(n-1), seq(l[-i], i=1..nops(l)))))(convert(n, base, 3)))
        end:
    seq(a(n), n=1..15);  # Alois P. Heinz, Feb 17 2023
  • Mathematica
    nn = 15; s = IntegerDigits[Range[nn], 3]; Array[FromDigits[Join @@ s[[1 ;; #]]] &, nn] (* Michael De Vlieger, Apr 19 2023 *)
  • Python
    from sympy.ntheory import digits
    def a(n): return int("".join("".join(map(str, digits(k, 3)[1:])) for k in range(1, n+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:=s+"".join(map(str, digits(n, 3)[1:]))) for n in count(1))
    print(list(islice(agen(), 15))) # Michael S. Branicky, Feb 18 2023

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

A359148 1, together with numbers k such that A173426(k) is prime.

Original entry on oeis.org

1, 10, 2446
Offset: 1

Views

Author

N. J. A. Sloane, Feb 17 2023

Keywords

Comments

Many of the comments following the "Most Wanted Prime" video assumed that A173426(1) was 11, and so "Numbers k such that A173426(k) is prime" should begin 1, 10, 2446, ... This is incorrect, A173426(1) = 1 and is not prime.
However, if the 1 is omitted the sequence is too short to include in the OEIS, so the present sequence will serve as a place-holder until we find the next term.
Its inclusion could also be justified by the OEIS policy of including published but erroneous sequences to serve as pointers to the correct versions.
Serge Batalov comments (see A173426) that a(4) >= 60000.

Crossrefs

A360507 Numbers k such that A360506(k) is prime.

Original entry on oeis.org

2, 5, 13, 57, 109, 638, 3069
Offset: 1

Views

Author

Rémy Sigrist and N. J. A. Sloane, Feb 18 2023

Keywords

Comments

Analogous to A360503, which gives the primes in A048435.

Examples

			A360506(5) = 4003 is prime, so 5 is a term.
		

Crossrefs

Extensions

a(6)-a(7) from Michael S. Branicky, Feb 18 2023
Showing 1-6 of 6 results.