%I #7 Jan 10 2021 16:07:52
%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
|