OFFSET
1,1
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..42745 (first 500 terms from Vincenzo Librandi)
FORMULA
EXAMPLE
1151 belongs to the sequence since it is a prime with sum of digits = 8.
MATHEMATICA
Select[Prime[Range[500000]], Total[IntegerDigits[#]]==8 &] (* Vincenzo Librandi, Jul 08 2014 *)
PROG
(Magma) [p: p in PrimesUpTo(20000) | &+Intseq(p) eq 8]; // Vincenzo Librandi, Jul 08 2014
From M. F. Hasler, Mar 09 2022: (Start)
(PARI) select( {is_A062343(p, s=8)=sumdigits(p)==s&&isprime(p)}, primes([1, 12345])) \\ 2nd optional parameter for similar sequences with other digit sums.
(PARI) {A062343_upto_length(L, s=8, a=List(), u=[10^(L-k)|k<-[1..L]])=forvec(d=[[1, L]|i<-[1..s]], isprime(p=vecsum(vecextract(u, d))) && listput(a, p), 1); Vecrev(a)} \\ (End)
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Amarnath Murthy, Jun 21 2001
EXTENSIONS
More terms from Larry Reeves (larryr(AT)acm.org), Jul 06 2001
STATUS
approved