OFFSET
1,1
LINKS
Christian N. K. Anderson, Table of n, a(n) for n = 1..25000 (terms 1..1000 from T. D. Noe)
Christian N. K. Anderson, Ulam Spiral for a(n) <= 100000.
EXAMPLE
89 included because 8+9 = 17, which is prime.
MAPLE
a:=proc(n) local nn: nn:=convert(n, base, 10): if isprime(sum(nn[j], j=1..nops(nn)))=true then n else fi end: seq(a(n), n=1..200); # Emeric Deutsch, Mar 17 2007
MATHEMATICA
Select[Range[200], PrimeQ[Total[IntegerDigits[#]]]&] (* Harvey P. Dale, Feb 18 2011 *)
PROG
(Haskell)
a028834 n = a028834_list !! (n-1)
a028834_list = filter ((== 1) . a010051 . a007953) [1..]
-- Reinhard Zumkeller, Nov 13 2011
(Sage) [x for x in range(200) if (sum(Integer(x).digits(base=10))) in Primes()] # Bruno Berselli, May 05 2014
(PARI) is(n)=isprime(sumdigits(n)) \\ Felix Fröhlich, Aug 16 2014
(Python)
from sympy import isprime
def ok(n): return isprime(sum(map(int, str(n))))
print(list(filter(ok, range(183)))) # Michael S. Branicky, Jun 18 2021
(R) require(gmp); which(sapply(1:1000, function(i) isprime(sum(floor(i/10^(0:(nchar(i)-1)))%%10)))==2) # Christian N. K. Anderson, Apr 22 2024
CROSSREFS
KEYWORD
nonn,base,easy,nice
AUTHOR
Armand Turpel (armand(AT)vo.lu, armand_t(AT)geocities.com)
EXTENSIONS
More terms from Scott Lindhurst (ScottL(AT)alumni.princeton.edu)
STATUS
approved