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.

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

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