|
|
A062341
|
|
Primes whose sum of digits is 5.
|
|
14
|
|
|
5, 23, 41, 113, 131, 311, 401, 1013, 1031, 1103, 1301, 2003, 2111, 3011, 4001, 10103, 10211, 10301, 11003, 12011, 12101, 13001, 20021, 20201, 21011, 21101, 30011, 100103, 101021, 101111, 102101, 103001, 120011, 121001, 200003, 200201, 201011, 201101, 202001
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
1301 belongs to the sequence since it is a prime with sum of digits = 5.
|
|
MAPLE
|
T:= n-> `if`(n=1, 5, sort(select(isprime, [seq(seq(seq(
10^(n-1)+1+10^i+10^j+10^k, k=1..j), j=1..i), i=1..n-1),
seq(10^(n-1)+3+10^i, i=1..n-1)]))[]):
|
|
MATHEMATICA
|
Select[Prime[Range[20000]], Total[IntegerDigits[#]]==5&] (* Harvey P. Dale, Nov 24 2013 *)
|
|
PROG
|
(Magma) [p: p in PrimesUpTo(250000) | &+Intseq(p) eq 5]; // Vincenzo Librandi, Jul 08 2014
(Python)
from sympy import primerange as primes
def ok(p): return sum(map(int, str(p))) == 5
(PARI)
select( {is_A062341(p, s=5)=sumdigits(p)==s&&isprime(p)}, primes([1, 10^6])) \\ 2nd optional parameter for similar sequences with other digit sums.
A062341_upto_length(L, s=5, a=List(), u=[10^k|k<-[0..L-1]])={forvec(d=[[1, L]|i<-[1..s]], isprime(p=vecsum(vecextract(u, d))) && listput(a, p), 1); Set(a)} \\ (End)
|
|
CROSSREFS
|
Subsequence of A062340 (primes with sum of digits divisible by 5).
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
Corrected and extended by Larry Reeves (larryr(AT)acm.org), Jul 06 2001
|
|
STATUS
|
approved
|
|
|
|