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.

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

A359149 Concatenate the binary strings for 1,2,...,n-1, n, n-1, ..., 2,1.

Original entry on oeis.org

1, 1101, 11011101, 1101110011101, 1101110010110011101, 1101110010111010110011101, 1101110010111011111010110011101, 11011100101110111100011111010110011101, 1101110010111011110001001100011111010110011101, 110111001011101111000100110101001100011111010110011101
Offset: 1

Views

Author

N. J. A. Sloane, Feb 18 2023

Keywords

Comments

Binary analog of A173426 and A360504.
Converting these binary strings to base 10 gives A173427. E.g. 1101_2 = 13_10 gives A173427(3) = 13.
What is the first prime here if these strings are regarded as decimal numbers as they stand? a(5) = 1101110010110011101 = 3*37*53*187168113226247 is obviously not a prime.

Crossrefs

Programs

  • Maple
    a:= n-> parse(cat(map(t-> convert(t, binary), [$1..n, n-i$i=1..n-1])[])):
    seq(a(n), n=1..10);  # Alois P. Heinz, Feb 18 2023
  • Mathematica
    a[n_] := FromDigits @ Flatten @ IntegerDigits[Join[Range[1, n], Range[n - 1, 1, -1]], 2]; Array[a, 10] (* Amiram Eldar, Feb 18 2023 *)
  • Python
    from itertools import count, islice
    def agen(): # generator of terms
        sl, sr, sk = "", "", "1"
        for k in count(1):
            sk = bin(k)[2:]
            sl += sk
            yield int(sl + sr)
            sr = sk + sr
    print(list(islice(agen(), 10))) # Michael S. Branicky, Feb 18 2023
Showing 1-2 of 2 results.