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.

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

This page as a plain text file.
%I A379355 #21 Jan 03 2025 01:58:10
%S A379355 3,2,2,13,2,13,59,31,263,73,23,31,449,31,59,313,2,3,211,317,31,449,
%T A379355 241,887,349,911,853,887,313,173,1777,179,967,503,331,113,163,359,
%U A379355 1153,281,97,1823,13,23,1657,269,223,3623,2017,233,61,1361,367,1031,79,389,577,2963,1741,59,13,1439,463,797
%N A379355 Beginning with 3, least prime such that the reversal concatenation of first n terms is prime.
%C A379355 "Reverse concatenation" here seems to refer 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". - _N. J. A. Sloane_, Jan 03 2025
%H A379355 Michael S. Branicky, <a href="/A379355/b379355.txt">Table of n, a(n) for n = 1..1000</a>
%t A379355 w = {3};
%t A379355 Do[k = 1;
%t A379355   q = Monitor[
%t A379355     Parallelize[
%t A379355      While[True,
%t A379355       If[PrimeQ[
%t A379355          FromDigits[
%t A379355           Join @@ IntegerDigits /@
%t A379355             Reverse[
%t A379355              IntegerDigits[
%t A379355               FromDigits[
%t A379355                Join @@ IntegerDigits /@ Append[w, Prime[k]]]]]]], Break[]]; k++];
%t A379355      Prime[k]], k];
%t A379355   w = Append[w, q], {i, 2, 57}];
%t A379355 w
%o A379355 (Python)
%o A379355 from itertools import count, islice
%o A379355 from gmpy2 import digits, is_prime, mpz, next_prime
%o A379355 def agen(): # generator of terms
%o A379355     r, an = "", 3
%o A379355     while True:
%o A379355         yield int(an)
%o A379355         r = digits(an)[::-1] + r
%o A379355         p = 2
%o A379355         while not is_prime(mpz(digits(p)[::-1]+r)): p = next_prime(p)
%o A379355         an = p
%o A379355 print(list(islice(agen(), 57))) # _Michael S. Branicky_, Dec 21 2024
%Y A379355 Cf. A111382, A111383, A113584, A379354.
%Y A379355 The primes produced are in A379782.
%K A379355 base,nonn
%O A379355 1,1
%A A379355 _J.W.L. (Jan) Eerland_, Dec 21 2024