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.

A195335 a(n) is the smallest Xmas tree prime with a(n-1) as a prefix (starting with 2).

Original entry on oeis.org

2, 211, 211151, 2111511013, 211151101310867, 211151101310867100673, 2111511013108671006731000357, 211151101310867100673100035710000931, 211151101310867100673100035710000931100000213, 2111511013108671006731000357100009311000002131000000901, 211151101310867100673100035710000931100000213100000090110000001797
Offset: 1

Views

Author

Kausthub Gudipati, Sep 16 2011

Keywords

Comments

A Xmas tree prime is a prime which is a concatenation of a prime with a single digit, a prime with two digits, a prime with three digits, a prime with four digits etc. By definition, the number of digits is a triangular number (A000217). Leading zeros are not allowed for any of the primes.

Crossrefs

Cf. A000217.

Programs

  • Maple
    read("transforms") ;
    A195335 := proc(n)
            option remember;
            local prev,nxt,a ;
            if n =1 then
                    2;
            else
                    prev := procname(n-1) ;
                    for nxt from 10^(n-1) to 10^n-1 do
                            if isprime(nxt) then
                                    a := digcat2(prev,nxt) ;
                                    if isprime(a) then
                                            return a ;
                                    end if;
                            end if;
                    end do:
                    return -1 ;
            end if;
    end proc: # R. J. Mathar, Sep 20 2011
  • Python
    from sympy import isprime, nextprime
    def alst(nn):
      alst, astr = [2], "2"
      for n in range(2, nn+1):
        p = nextprime(10**(n-1))
        while not isprime(int(astr + str(p))): p = nextprime(p)
        alst.append(int(astr + str(p))); astr += str(p)
      return alst
    print(alst(11)) # Michael S. Branicky, Dec 26 2020

Extensions

Name corrected by Michael S. Branicky, Dec 26 2020