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.

A376118 Cryptarithmically unique palindromic primes.

Original entry on oeis.org

11, 11141414111, 11999199911, 13111311131, 1110110110111, 1141411141411, 1611116111161, 3113113113113, 3222223222223, 3533355533353, 7444477744447, 7767777777677, 7887787877887, 7999979799997, 9494994994949, 9779999999779, 118818181818811, 131133131331131, 944499494994449, 10000010101000001
Offset: 1

Views

Author

Dmytro Inosov, Sep 11 2024

Keywords

Comments

Each prime in this sequence is simultaneously a palindrome in base 10 and has a unique decimal digit pattern A358497(a(n)) in the sense that no other prime has the same pattern.
All terms except 11 have an odd number of digits (cf. A002385).
Number of terms < 100^k: 1, 1, 1, 1, 1, 4, 16, 19, (92), (249), (416), (1093)... . The numbers in brackets are conjectured based on the calculated terms with 1, 2, or 3 distinct digits and the vanishing combinatorial probability of terms with 4 or more distinct digits at these lengths.
The smallest term with 3 distinct digits is 11155511521212511555111.

Examples

			11141414111 is a term since it's a palindromic prime and no other prime has the same pattern "AAABABABAAA" of repeating digits.
Counterexample: the palindromic prime 131 is not a term since another prime 151 has the same pattern "ABA" of repeating digits.
		

Crossrefs

Intersection of A374238 and A002113.
Subsequence of A002385.
Supersequence of A004022 (prime repunits).
Cf. A358497.

Programs

  • Mathematica
    NumOfDigits = 13; (* Maximal integer length to be searched for *)
    (* A function that calculates the canonical form A358497[n] *)
    A358497[k_] := FromDigits@a358497C[k]
    a358497C = Compile[{{k, _Integer}}, Module[{firstpos = ConstantArray[0, 10], digits = IntegerDigits[k], indx = 0}, Table[If[firstpos[[digits[[j]] + 1]] == 0, firstpos[[digits[[j]] + 1]] = Mod[++indx, 10]]; firstpos[[digits[[j]] + 1]], {j, Length[digits]}]]];
    (* Extracting cryptarithmically uniqie terms from palindromic primes *)
    UniquePalPrimes = {11};
    Do[PalindromicPrimes = {}; CryptUnique = {};
      Do[If[PrimeQ[#], AppendTo[PalindromicPrimes,{#, A358497[#]}]]&[n*10^(IntegerLength[n]-1) +
         FromDigits@Rest@Reverse@IntegerDigits[n]], {n, 10^(k-1), 10^k-1}];
      CryptUnique = Extract[Extract[Select[Tally[PalindromicPrimes, #1[[2]]==#2[[2]] &], #[[2]]==1 &], {All,1}], {All,1}];
      UniquePalPrimes = Join[UniquePalPrimes, CryptUnique];
      (* Prints the number of results and the list of results for every integer length *)
      Print[{2k-1, Length[CryptUnique], CryptUnique}], {k, 2, (NumOfDigits+1)/2}];
    UniquePalPrimes