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.

A374350 Least n-digit reversible prime whose difference from its reversal is minimal.

Original entry on oeis.org

2, 11, 101, 1231, 10301, 105601, 1003001, 10012001, 100030001, 1007457001, 10000500001, 100124521001, 1000008000001, 10000523500001, 100000323000001, 1000034344300001, 10000000500000001, 100000188981000001, 1000000008000000001, 10000001189110000001, 100000000212000000001
Offset: 1

Views

Author

Robert G. Wilson v, Jul 05 2024

Keywords

Comments

Inspired by A084475 and A373349.
For n > 1, a(2n) has a difference of 9*10^n and a(2n-1) has a difference of 0.

Examples

			a(3) = 101 since its reversal is also 101;
a(4) = 1231 since its reversal is 1321 which is also prime and their difference is minimal at 90;
a(6) = 105601 since its reversal is 106501 which is also prime and their difference is minimal at 900;
a(8) = 10012001 since its reversal is 10021001 which is also prime and their difference is minimal at 9000; etc.
		

Crossrefs

Programs

  • Mathematica
    fe[n_] := Block[{k = 1, j, p, q}, While[ j = k(10^IntegerLength[k]) + IntegerReverse[k +1]; p = 10^(2 n -1) + j(10^(n - IntegerLength[j]/2)) + 1; q = IntegerReverse@ p; !PrimeQ@ p || !PrimeQ@ q, k++; If[ Mod[k, 10] == 9, k++]]; p]; fe[1] = 11;
    fo[n_] := Block[{k = 0, j, p}, While[ j = k(10^(IntegerLength[k] -1)) + IntegerReverse@ Quotient[k, 10]; p = 10^(2n -2) + j(10^(n - (IntegerLength[j] + 1)/2)) +1; !PrimeQ@ p, k++]; p];
    a[n_] := If[ OddQ@ n, fo[(n +1)/2], fe[n/2]]; Array[a, 21]

Formula

a(2n-1) = A100027(n) = A028989(n).