What Is the Last Prime Quadruplet in the Sequence i, i+2, i+6, i+8?

  • Context: Comp Sci 
  • Thread starter Thread starter ƒ(x) → ∞
  • Start date Start date
  • Tags Tags
    Beginner Fortran
Click For Summary

Discussion Overview

The discussion revolves around identifying the last prime quadruplet in the sequence defined by the numbers i, i+2, i+6, and i+8. Participants explore the concept of prime quadruplets and the methods for finding them, particularly through programming techniques such as the sieve of Eratosthenes.

Discussion Character

  • Homework-related, Technical explanation, Exploratory

Main Points Raised

  • One participant shares a Fortran program intended to find prime quadruplets by using a sieve method to identify prime numbers up to 1,000,000.
  • Another participant questions the original request for clarification on what is meant by "primes that are i apart," suggesting that primes differing by 0 are not interesting.
  • A participant clarifies that they are looking for groups of primes that differ by 2, 6, and 8, providing an example of such a group.
  • One participant suggests a method for finding prime quadruplets by checking for primes at specific offsets in the array after applying the sieve method.
  • There is a request for help in compiling the provided code, indicating a potential issue with the compiler being used.
  • A participant expresses concern about their compiler's functionality and inquires about the availability of online compilers.

Areas of Agreement / Disagreement

Participants generally agree on the approach of using the sieve method to find primes, but there is some confusion regarding the initial question and the specifics of the implementation. The discussion remains unresolved regarding the last prime quadruplet and the compilation issues raised.

Contextual Notes

There are limitations regarding the clarity of the initial question and the specifics of the programming implementation. The discussion does not resolve the issue of the compiler errors or the final identification of the last prime quadruplet.

ƒ(x) → ∞
Messages
24
Reaction score
0

Homework Statement



I am trying to find prime numbers that are i,i+2,i+6,i+8 apart. Could someone tell me the last set that this gives?

Homework Equations



-

The Attempt at a Solution



program sieve_t
implicit none
integer*1 s(1000000), offset (10), sequence
integer i, j, n

n=0
sequence=4

do i=1, 10
offset(i)=0
enddo

offset(1)=2
offset(2)=4
offset(3)=2

do i=1, 1000000
s(i) = 1
enddo

do i=2, 1000000
if (s(i).eq.1) then
do j=2, (1000000/i)
s(i*j)=0
enddo
endif
enddo

do i=2, 1000000

if (s(i).eq.1) then
do j=1,sequence-1
if (s(i+offset(j)).ne.1) goto 10
enddo
n=n+1
write(*,*) n, i,i+2,i+6,i+8
endif
10 continue
enddo


end
 
Physics news on Phys.org
I'm not sure what you are asking. What does primes that are "i apart" mean? Are you asking for primes that differ by 0, 2, 6, and 8? Primes that differ by 0 aren't very interesting, since they would necessarily be equal. There are lots of primes that differ by 2, the first few pairs of which are 3 and 5, 5 and 7, and 11 and 13.

Please clarify what you're trying to do.
 
Sorry Mark44.

I am looking for groups of primes. I am basically looking for prime quadruplets that differ by 2 and 6 and 8.

For example {5, 7, 11, 13}
 
OK, now I understand. One approach would be to first go through your array of 1,000,000 numbers looking for primes, using the sieve approach as you have been doing. After you have that array of 1s and 0s, then iterate through it looking for a 1. When you find a 1, check whether there is a 1 at position i + 2, i + 6, and i + 8. If there are 1s in all those positions, you have found a prime quadruplet.
 
Could you compile it?
 
Not sure I understand your question. I don't have a Fortran compiler. Did you try my suggestion and get compiler errors? Please clarify what you're asking.
 
I think that my compiler has a bug in it, because it cannot even compile a correct code.

Are there any online compilers?
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
6K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 32 ·
2
Replies
32
Views
5K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 11 ·
Replies
11
Views
7K
  • · Replies 21 ·
Replies
21
Views
3K