[seqfan] Re: Comment about A002822

Heinz, Alois alois.heinz at hs-heilbronn.de
Fri May 24 14:02:47 CEST 2019


This is not efficient:

See the for-loop "from 1 to k"

Please do not add this as a comment.

Best regards,

Alois

Am 24.05.2019 um 11:29 schrieb nando:
> Hi SeqFans,
>
> I know about an algorithm for testing whether an integer n belongs to
> the A002822 sequence (Numbers n such that 6n-1, 6n+1 are twin primes).
> The interesting part (at least for me) is that this algorithm involves
> no primality tests whatsoever.
>
> For n >= 4
> * compute k = floor((1+sqrt(1+6n))/6)
> * n is a member of A002822 iff neither (6j-1) nor (6j+1) divide
> (n^2-j^2) for all j from 1 to k
>
> For n < 4, the above k turns out to be 0, so there are no filters and
> the test is passed by default.
>
> I've never seen this algorithm mentioned anywhere, so I'm looking for
> feedback from the list subscribers as to whether or not this could
> possibly be a worthy addition to the comments of that sequence.
>
> Thanks.
> -- Nando
>
> --
> Seqfan Mailing list - http://list.seqfan.eu/



More information about the SeqFan mailing list