OFFSET
1,2
COMMENTS
By Dirichlet's theorem on primes in arithmetic progressions, for any positive integer k this sequence has infinitely many terms of the form k*10^m. - Robert Israel, Dec 19 2021
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
1234 is a term because 4*(1+2+3+4)+1 = 41.
MAPLE
filter:= proc(n) local L;
L:= convert(n, base, 10);
isprime(convert(L, `+`)*nops(L)+1)
end proc:
select(filter, [$1..200]); # Robert Israel, Dec 19 2021
MATHEMATICA
Select[Range[130], PrimeQ[Total[IntegerDigits[#]]IntegerLength[ #]+ 1]&] (* Harvey P. Dale, Jul 12 2011 *)
PROG
(Python)
from sympy import isprime
def ok(n): s = str(n); return isprime(sum(map(int, s))*len(s) + 1)
print([k for k in range(128) if ok(k)]) # Michael S. Branicky, Dec 19 2021
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Jason Earls, Aug 17 2005
STATUS
approved