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.

A380011 Beginning with 7, least prime such that the reversal concatenation of the first n terms is prime.

This page as a plain text file.
%I A380011 #19 Jan 18 2025 14:45:51
%S A380011 7,3,3,13,3,2,13,47,43,47,37,41,109,41,139,149,109,263,73,563,163,41,
%T A380011 19,797,61,107,31,821,43,149,37,953,211,89,547,353,337,167,67,239,
%U A380011 1009,449,97,23,349,41,31,911,61,929,229,797,331,191,463,107,463,809,2887,971
%N A380011 Beginning with 7, least prime such that the reversal concatenation of the first n terms is prime.
%C A380011 "Reverse concatenation" here refers to the decimal concatenation R(a(n)) || R(a(n-1)) || ... || R(a(3)) || R(a(2)) || R(a(1)) where R(k) means "reverse digits of k".
%H A380011 J.W.L. (Jan) Eerland, <a href="/A380011/b380011.txt">Table of n, a(n) for n = 1..982</a>
%t A380011 w={7};Do[k=1;q=Monitor[Parallelize[While[True,If[PrimeQ[FromDigits[Join@@IntegerDigits/@Reverse[IntegerDigits[FromDigits[Join@@IntegerDigits/@Append[w,Prime[k]]]]]]],Break[]];k++];Prime[k]],k];w=Append[w,q],{i,2,50}];w
%o A380011 (Python)
%o A380011 from itertools import count, islice
%o A380011 from gmpy2 import digits, is_prime, mpz, next_prime
%o A380011 def agen(): # generator of terms
%o A380011     r, an = "", 7
%o A380011     while True:
%o A380011         yield int(an)
%o A380011         r = digits(an)[::-1] + r
%o A380011         p = 2
%o A380011         while not is_prime(mpz(digits(p)[::-1]+r)): p = next_prime(p)
%o A380011         an = p
%o A380011 print(list(islice(agen(), 50))) # after _Michael S. Branicky_ in A379355
%Y A380011 Cf. A111382, A111383, A113584, A379354, A379355, A379761, A380010.
%K A380011 base,nonn
%O A380011 1,1
%A A380011 _J.W.L. (Jan) Eerland_, Jan 09 2025