All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Some prime sequences (Posted on 2018-07-04)
What numbers N are the sum of a sequence of consecutive primes such that the product of the first and last numbers in the sequence is N?

 No Solution Yet Submitted by Ady TZIDON No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 Here are some | Comment 1 of 11

Choosing amongst only the first 9592 primes:

10 =  2 +  3 +  5

39 =  3 +  5 +  7 + 11 + 13

155 =  5 +  7 + 11 + 13 + 17 + 19 + 23 + 29 + 31

371 =  7 + 11 + 13 + 17 + 19 + 23 + 29 + 31 + 37 + 41 + 43 + 47 + 53

I imagine an upper limit can be analytically determined where the product surpasses any possible sum by virtue of the magnitude of the 1st prime exceeding the sqrt of the sum of any possible span of primes up to the 2nd prime of the product (he said, waving his hands frantically...).

program sss

implicit none

integer i,j,k,primes(1000000),pcnt,lim,len,

1 ll,last,l,maxlen,ibeg

integer*16 prod,sum

c

c generate primes from 1 to 10^i

c

primes(1)=2

pcnt=1

2       print*,'k?'

if(k.lt.2.or.k.gt.7)go to 2

do 1 j=3,10**k,2

lim=sqrt(1.*j)+1

do i=3,lim,2

if(1.*i*int((1.*j)/i).eq.j)go to 1

enddo

pcnt=pcnt+1

primes(pcnt)=j

c           print*,j

c           if(j.gt.30)stop

1           enddo

do ibeg=1,pcnt-1

c           print*,'ibeg= ',ibeg

maxlen=pcnt-ibeg+1

do len=2,maxlen

last=ibeg+len-1

sum=0

do l=ibeg,last

sum=sum+primes(l)

enddo

prod=primes(ibeg)*primes(last)

if(sum.eq.prod)then

c                   print*,' sum ',sum

print 3,sum,(primes(ll),ll=ibeg,last)

3                   format(i4,' = ',30(i2,1x,'+ '))

endif

enddo

enddo

c           do i=1,20

c           print*,primes(i)

c           enddo

print*,pcnt

end

rabbit-3:~ lord\$ sss

k?

5

10 =  2 +  3 +  5 +

39 =  3 +  5 +  7 + 11 + 13 +

155 =  5 +  7 + 11 + 13 + 17 + 19 + 23 + 29 + 31 +

371 =  7 + 11 + 13 + 17 + 19 + 23 + 29 + 31 + 37 + 41 + 43 + 47 + 53 +

Edited on July 5, 2018, 1:50 pm
 Posted by Steven Lord on 2018-07-04 11:27:34

 Search: Search body:
Forums (0)
Random Problem
Site Statistics
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox: