login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A062337 Primes whose sum of digits is 7. 9

%I #29 Mar 10 2022 01:44:34

%S 7,43,61,151,223,241,313,331,421,601,1033,1051,1123,1213,1231,1303,

%T 1321,2113,2131,2203,2221,2311,3121,3301,4003,4021,4111,4201,5011,

%U 5101,10141,10303,10321,10501,11113,11131,11311,12211,12301,13003,14011

%N Primes whose sum of digits is 7.

%C There are O((log n)^6) members of this sequence below n.

%H Charles R Greathouse IV, <a href="/A062337/b062337.txt">Table of n, a(n) for n = 1..10000</a>

%F Intersection of A000040 (primes) and A052221 (digit sum 7). - _M. F. Hasler_, Mar 09 2022

%e 601 is a prime with sum of the digits = 7, hence belongs to the sequence.

%t Select[Prime[Range[3000]], Plus @@ IntegerDigits[ # ] == 7 &] (_Zak Seidov_, Feb 17 2005)

%o (PARI) A062337(lim)={my(pow=ceil(log(floor(lim)-.5)/log(10)),n);print("Checking for members of A062337 up to 10^"pow);for(a=0,pow-1,for(b=0,a,for(c=0,b,for(d=0,c,for(e=0,d,for(f=0,e,n=10^a+10^b+10^c+10^d+10^e+10^f+1;if(isprime(n),print1(n","))))))))};

%o (PARI) SumD(x)= { s=0; while (x>9, s+=x-10*(x\10); x\=10); return(s + x) } { default(primelimit, 2*10^8); n=0; forprime (p=2, 2*10^8, if (SumD(p) == 7, write("b062337.txt", n++, " ", p); if (n==500, break)) ) } \\ _Harry J. Smith_, Aug 05 2009

%o From _M. F. Hasler_, Mar 09 2022: (Start)

%o (PARI) select( {is_A062337(p, s=7)=sumdigits(p)==s&&isprime(p)}, primes([1, 14321])) \\ 2nd optional parameter for similar sequences with other digit sums.

%o (PARI) {A062337_upto_length(L, s=7, 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)

%o (Magma) [p: p in PrimesUpTo(250000) | &+Intseq(p) eq 7]; // _Vincenzo Librandi_, Jul 08 2014

%Y Subsequence of A062336. See also A000579.

%Y Cf. similar sequences listed in A244918.

%K nonn,base,easy

%O 1,1

%A _Amarnath Murthy_, Jun 21 2001

%E More terms from Larry Reeves (larryr(AT)acm.org), Jul 06 2001

%E Comments and program from _Charles R Greathouse IV_, Sep 11 2009

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 06:24 EDT 2024. Contains 371769 sequences. (Running on oeis4.)