login
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.
20
2, 3, 4, 6, 9, 10, 16, 40, 104, 8840
OFFSET
1,1
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<n, so the case k=n, the subject of this sequence, is the first time a prime is possible.
Sequence A260852 lists the actual primes, A260852(k) = A260851(a(k)). - M. F. Hasler, Aug 02 2015
LINKS
EXAMPLE
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.
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 *)
PROG
(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
(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
CROSSREFS
For n=2 see A173427, for n=10 see A173426.
For n=3 through n=16 see A260853 - A260866.
Sequence in context: A337724 A175515 A241241 * A215818 A132600 A163627
KEYWORD
nonn,base,more
AUTHOR
N. J. A. Sloane, Aug 01 2015
STATUS
approved