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.

A331097 a(n) is the greatest prime number of the form n mod (10^k) for some k > 0, or 0 if no such prime number exists.

This page as a plain text file.
%I A331097 #14 Jan 12 2020 13:49:01
%S A331097 0,0,2,3,0,5,0,7,0,0,0,11,2,13,0,5,0,17,0,19,0,0,2,23,0,5,0,7,0,29,0,
%T A331097 31,2,3,0,5,0,37,0,0,0,41,2,43,0,5,0,47,0,0,0,0,2,53,0,5,0,7,0,59,0,
%U A331097 61,2,3,0,5,0,67,0,0,0,71,2,73,0,5,0,7,0,79,0
%N A331097 a(n) is the greatest prime number of the form n mod (10^k) for some k > 0, or 0 if no such prime number exists.
%C A331097 In other words, a(n) is the largest prime suffix of n, or 0 if no such suffix exists.
%H A331097 Rémy Sigrist, <a href="/A331097/b331097.txt">Table of n, a(n) for n = 0..10000</a>
%F A331097 a(n) <= n with equality iff n = 0 or n is a prime number.
%e A331097 For n = 42:
%e A331097 - 42 mod (10^k) = 42 is not prime for k >= 2,
%e A331097 - 42 mod 10 = 2 is prime,
%e A331097 - hence a(42) = 2.
%o A331097 (PARI) a(n,base=10) = my (d=digits(n, base), s); for (k=1, #d, if (isprime(s=fromdigits(d[k..#d], base)), return (s))); 0
%Y A331097 Cf. A047814, A331044, A331102 (binary analog).
%K A331097 nonn,base
%O A331097 0,3
%A A331097 _Rémy Sigrist_, Jan 09 2020