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.

A260343 Numbers n such that the base-n number formed by concatenating the base-n numbers 1 2 ... n-1 n n-1 ... 2 1 is prime.

Original entry on oeis.org

2, 3, 4, 6, 9, 10, 16, 40, 104, 8840
Offset: 1

Views

Author

N. J. A. Sloane, Aug 01 2015

Keywords

Comments

n = 8840 only corresponds to a probable prime (with 69770 decimal digits).
The concatenation (in base n) of the base-n numbers 1 2 3 ... k-1 k k-1 ... 3 2 1 is a square for k
Sequence A260852 lists the actual primes, A260852(k) = A260851(a(k)). - M. F. Hasler, Aug 02 2015

Examples

			For n = 2 we get the binary number 1 10 1 = 1101 = 13 (in decimal).
For n = 10 we get (as David Broadhurst remarks) the "memorable" decimal prime 12345678910987654321.
For n = 16 the prime is the hexadecimal number 123456789abcdef10fedcba987654321.
		

Crossrefs

For n=2 see A173427, for n=10 see A173426.
For n=3 through n=16 see A260853 - A260866.

Programs

  • Mathematica
    Select[Range[2, 120], PrimeQ@ Total[Times @@@ Transpose[{(Function[p, Power[#, p]] /@ Reverse@ Delete[Range[0, 2 # - 1], # + 1]), Flatten@ {Range[#], Reverse@ Range[# - 1]}}]] &] (* Michael De Vlieger, Aug 02 2015 *)
    bnpQ[n_]:=PrimeQ[FromDigits[Flatten[Join[IntegerDigits[#,n]&/@Range[n], IntegerDigits[ #,n]&/@Reverse[Range[n-1]]]],n]]; Select[Range[2,110],bnpQ] (* Harvey P. Dale, Feb 26 2023 *)
  • PARI
    for(b=2,9e9,ispseudoprime(p=(1+b*c=(b^b-1)\(b-1))*(c-b+1)-1)&&print1(b", ")); \\ D. Broadhurst and M. F. Hasler, Aug 02 2015
  • Python
    from gmpy2 import is_prime
    def intbase(dlist,b=10): # convert list of digits in base b to integer
        y = 0
        for d in dlist:
            y = y*b + d
        return y
    A260343_list = [n for n in range(2,500) if is_prime(intbase(list(range(1,n))+[1,0]+list(range(n-1,0,-1)), n))] # Chai Wah Wu, Aug 01 2015