login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A226149 Smallest of three consecutive primes whose average is a square. 3

%I

%S 2393,25913,47951,123191,131759,219953,330611,356387,450227,769117,

%T 826271,870479,1026143,1500613,1515347,1697797,1846861,1907141,

%U 2013541,2217107,2486873,2732383,3229189,3294191,3956101,4338871,4481677,4739297,5022067,5239511,5294591,5774387

%N Smallest of three consecutive primes whose average is a square.

%t Select[Partition[Prime[Range[400000]],3,1],IntegerQ[Sqrt[Mean[#]]]&][[All,1]] (* _Harvey P. Dale_, Jan 10 2021 *)

%o (C)

%o #include <stdio.h>

%o #include <stdlib.h>

%o #include <math.h>

%o #define TOP (1ULL<<30)

%o int main() {

%o unsigned long long i, j, p1, p2, r, s;

%o unsigned char *c = (unsigned char *)malloc(TOP/8);

%o memset(c, 0, TOP/8);

%o for (i=3; i < TOP; i+=2)

%o if ((c[i>>4] & (1<<((i>>1) & 7)))==0 /*&& i<(1ULL<<32)*/)

%o for (j=i*i>>1; j<TOP; j+=i) c[j>>3] |= 1 << (j&7);

%o for (p2=2, p1=3, i=5; i < TOP; i+=2)

%o if ((c[i>>4] & (1<<((i>>1) & 7)))==0) {

%o s = p2 + p1 + i;

%o if ((s%3)==0) {

%o s/=3;

%o r = sqrt(s);

%o if (r*r==s) printf("%llu, ", p2);

%o }

%o p2 = p1, p1 = i;

%o }

%o return 0;

%o }

%Y Cf. A076304, A206279, A226145-A226150.

%K nonn

%O 1,1

%A _Alex Ratushnyak_, May 28 2013

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 24 09:10 EDT 2021. Contains 347630 sequences. (Running on oeis4.)