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.

A224953 Number of ways a digit can be appended or prepended to n and form a prime.

This page as a plain text file.
%I A224953 #43 May 24 2024 01:32:19
%S A224953 4,9,3,9,3,3,2,9,2,6,4,6,1,7,1,2,2,5,1,9,0,4,3,6,1,2,2,6,2,5,1,8,0,5,
%T A224953 2,2,1,6,2,6,2,6,1,7,2,1,3,6,1,5,2,3,2,5,2,1,2,8,1,6,2,7,0,6,3,2,1,7,
%U A224953 1,4,2,5,1,7,1,2,2,6,1,5,1,4,4,7,0,3,1
%N A224953 Number of ways a digit can be appended or prepended to n and form a prime.
%C A224953 The prime number may be formed by adding a digit either before or after n, though only odd numbers can become prime by having digits added before n.
%C A224953 Appending a zero before n produces a prime if and only if n is prime. Conversely, for all prime numbers p, a(p) > 0.
%C A224953 In theory, a maximum of 7 digits could be added before any n, and 3 of the odd digits after n in cases where [10*n, 10*n+9] contains a number that is a factor of 3, 5 and 7 (the three single-digit odd primes). In practice, it appears that all 10 possibilities are never realized. There are 9 possibilities for n = {1, 3, 7, 19}.
%C A224953 The only example of a prime being formed two different ways is for n = 1, which can become 11 if a 1 is appended to either the front or the back. These are naively counted as two distinct alternatives. [This would also be true for n = A002275(A004023(k) - 1) for k > 1 as appending a 1 to either the front or the back forms the k-th repunit prime. - _Michael S. Branicky_, May 22 2024]
%C A224953 The term a(29587) is the first occurrence of 10. The primes are 29587, 129587, 329587, 429587, 729587, 929587, 295871, 295873, 295877, and 295879. This is the only occurrence of 10 for n < 10^8. - _T. D. Noe_, Apr 21 2013
%H A224953 Christian N. K. Anderson, <a href="/A224953/b224953.txt">Table of n, a(n) for n = 0..9999</a>
%H A224953 Christian N. K. Anderson, <a href="/A224953/a224953.txt">Primes formed by appending digits to n for n = 0..9999</a>
%e A224953 a(0) = 4 because there are 4 ways to concatenate a digit to 0 to produce a prime number: 02, 03, 05, and 07.
%e A224953 a(3) = 9 because a digit can be concatenated to 3 in 9 ways to produce a prime number: 03, 13, 23, 43, 53, 73, 83, 31, and 37.
%t A224953 Table[num = IntegerDigits[n]; cnt = 0; Do[If[PrimeQ[FromDigits[Prepend[num, k]]], cnt++], {k, 0, 9}]; Do[If[PrimeQ[FromDigits[Append[num, k]]], cnt++], {k, 0, 9}]; cnt, {n, 0, 86}] (* _T. D. Noe_, Apr 20 2013 *)
%o A224953 (R) sapply(1:100, function(x) sum(sapply(as.numeric(c(paste0(0:9,x), paste0(x,c(1,3,7,9)))), is_prime  ))) # _Christian N. K. Anderson_, Apr 30 2024
%Y A224953 Cf. A087388, A087389, A087390.
%Y A224953 Cf. A069686.
%Y A224953 Cf. A075595.
%Y A224953 Cr. A002275, A004023.
%Y A224953 Index of zeros in this sequence: A124665.
%K A224953 nonn,base
%O A224953 0,1
%A A224953 _Christian N. K. Anderson_ and _Kevin L. Schwartz_, Apr 20 2013