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.

This page as a plain text file.
%I A260343 #39 Feb 26 2023 17:17:39
%S A260343 2,3,4,6,9,10,16,40,104,8840
%N 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.
%C A260343 n = 8840 only corresponds to a probable prime (with 69770 decimal digits).
%C A260343 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.
%C A260343 Sequence A260852 lists the actual primes, A260852(k) = A260851(a(k)). - _M. F. Hasler_, Aug 02 2015
%H A260343 D. Broadhurst, <a href="https://listserv.nodak.edu/cgi-bin/wa.exe?A2=NMBRTHRY;af419558.1508">Primes from concatenation: results and heuristics</a>, NmbrThry List, August 1, 2015
%e A260343 For n = 2 we get the binary number 1 10 1 = 1101 = 13 (in decimal).
%e A260343 For n = 10 we get (as David Broadhurst remarks) the "memorable" decimal prime 12345678910987654321.
%e A260343 For n = 16 the prime is the hexadecimal number 123456789abcdef10fedcba987654321.
%t A260343 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 *)
%t A260343 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 *)
%o A260343 (Python)
%o A260343 from gmpy2 import is_prime
%o A260343 def intbase(dlist,b=10): # convert list of digits in base b to integer
%o A260343     y = 0
%o A260343     for d in dlist:
%o A260343         y = y*b + d
%o A260343     return y
%o A260343 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
%o A260343 (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
%Y A260343 For n=2 see A173427, for n=10 see A173426.
%Y A260343 For n=3 through n=16 see A260853 - A260866.
%K A260343 nonn,base,more
%O A260343 1,1
%A A260343 _N. J. A. Sloane_, Aug 01 2015