Displaying 1-10 of 12 results found.
Smaller of two consecutive primes whose sum is a square.
+10
17
17, 47, 71, 283, 881, 1151, 1913, 2591, 3527, 4049, 6047, 7193, 7433, 15137, 20807, 21617, 24197, 26903, 28793, 34847, 46817, 53129, 56443, 69191, 74489, 83231, 84047, 98563, 103049, 103967, 109507, 110441, 112337, 136237, 149057, 151247
EXAMPLE
a(4) = 283, the next prime is 293 and 283 + 293 = 576 = 24^2.
MATHEMATICA
Transpose[Select[Partition[Prime[Range[20000]], 2, 1], IntegerQ[Sqrt[Plus@@# ]]&]][[1]] (* Harvey P. Dale, Aug 04 2009 *)
PROG
(PARI) { default(primelimit, 550655327); n=0; q=2; forprime (p=3, 550655327, if (issquare(p+q), write("b061275.txt", n++, " ", q)); q=p ) } \\ Harry J. Smith, Jul 20 2009
EXTENSIONS
More terms from Larry Reeves (larryr(AT)acm.org) and Asher Auel, May 15 2001
Numbers k such that k^2 is a sum of three successive primes.
+10
14
7, 11, 29, 31, 43, 151, 157, 191, 209, 217, 221, 263, 311, 359, 367, 407, 493, 533, 563, 565, 637, 781, 815, 823, 841, 859, 881, 929, 959, 997, 1013, 1019, 1021, 1087, 1199, 1211, 1297, 1353, 1471, 1573, 1613, 1683, 1685, 1733, 1735, 1739, 1751, 1761, 1769
FORMULA
a(n) = sqrt(prime(i) + prime(i+1) + prime(i+2)) where i = A076305(n). [Corrected by M. F. Hasler, Jan 03 2020]
EXAMPLE
7 is in this sequence because 7^2 = 49 = p(6) + p(7) + p(8) = 13 + 17 + 19.
MATHEMATICA
Select[Table[Sqrt[Sum[Prime[k], {k, n, n + 2}]], {n, 100000}], IntegerQ] (* Ray Chandler, Sep 29 2006 *)
Select[Sqrt[#]&/@(Total/@Partition[Prime[Range[90000]], 3, 1]), IntegerQ] (* Harvey P. Dale, Feb 23 2011 *)
PROG
(PARI) is(n, p=precprime(n^2/3), q=nextprime(p+1), t=n^2-p-q)=isprime(t) && t==if(t>q, nextprime(q+1), precprime(p-1)) \\ Charles R Greathouse IV, May 26 2013; edited by M. F. Hasler, Jan 03 2020
(PARI) A76304=[7]; apply( A076304(n)={if(n>#A76304, my(i=#A76304, N=A76304[i]); A76304=concat(A76304, vector(n-i, i, until( is(N+=2), ); N))); A76304[n]}, [1..99]) \\ M. F. Hasler, Jan 03 2020
Numbers k such that prime(k) + prime(k+1) + prime(k+2) is a square.
+10
10
6, 12, 59, 65, 112, 965, 1029, 1455, 1706, 1830, 1890, 2573, 3457, 4490, 4664, 5609, 7927, 9130, 10078, 10143, 12597, 18248, 19727, 20086, 20887, 21708, 22739, 25041, 26536, 28511, 29346, 29664, 29774, 33387, 39945, 40677, 46136, 49869, 58135
COMMENTS
See A076304 for the square roots of the sums of the three primes.
EXAMPLE
6 is a term because prime(6) + prime(7) + prime(8) = 13 + 17 + 19 = 49 = 7^2.
MATHEMATICA
Select[Range[60000], IntegerQ[Sqrt[Sum[Prime[k], {k, #, # + 2}]]] &] (* Ray Chandler, Sep 26 2006 *)
Position[Partition[Prime[Range[60000]], 3, 1], _?(IntegerQ[Sqrt[ Total[ #]]]&), 1, Heads->False]//Flatten (* Harvey P. Dale, Sep 28 2018 *)
PROG
(PARI) n=0; p=2; q=3; forprime(r=5, 1e9, n++; if(issquare(p+q+r), print1(n", ")); p=q; q=r) \\ Charles R Greathouse IV, Apr 07 2017
(Magma) [k:k in [1..60000]| IsSquare(&+[NthPrime(k+m):m in [0, 1, 2]])]; // Marius A. Burtea, Jan 04 2020
Smallest of four consecutive primes whose sum is a square.
+10
10
5, 73, 137, 433, 569, 1217, 5171, 15859, 16631, 32027, 35677, 37619, 39191, 45767, 59029, 63997, 65011, 77813, 92401, 103669, 186601, 196201, 230387, 237161, 261089, 273517, 439559, 463747, 484397, 488573, 505511, 514079, 519803, 538739, 544627, 633599
EXAMPLE
a(4) = 433. The next three primes are 439, 443, and 449, and the sum of those four primes = 1764 = 42^2.
MATHEMATICA
Transpose[Select[Partition[Prime[Range[80000]], 4, 1], IntegerQ[Sqrt[ Total[#]]]&]][[1]]
Numbers n such that triangular(n) is a sum of three successive primes.
+10
7
4, 5, 61, 82, 142, 166, 202, 233, 337, 394, 418, 422, 446, 493, 538, 661, 670, 841, 886, 1101, 1177, 1234, 1237, 1266, 1322, 1426, 1441, 1477, 1593, 1642, 1690, 1713, 1765, 1789, 1798, 1885, 1901, 1930, 1941, 2041, 2061, 2098, 2101, 2161, 2218, 2277, 2305, 2350, 2614
EXAMPLE
For k = 5, triangular(k) = triangular(5) = 15. 15/3 = 5. The next prime larger or equal to 5 is 5. The prime before 5 is 3. If there is a triple of consecutive primes that sum to 15 then 3 and 5 are two of them. Then the third one must be 15 - 3 - 5 = 7. 7 is prime and 3, 5 and 7 are consecutive primes (as 7 is the next larger prime than 5 or the previous prime to 3). Therefore, k = 5 is in the sequence. - David A. Corneth, Sep 18 2019
MATHEMATICA
(Sqrt[8#+1]-1)/2&/@Select[Total/@Partition[Prime[Range[ 100000]], 3, 1], OddQ[ Sqrt[8#+1]]&] (* Harvey P. Dale, Sep 18 2019 *)
PROG
(C)
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define TOP (1ULL<<30)
int main() {
unsigned long long i, j, p1, p2, r, s;
unsigned char *c = (unsigned char *)malloc(TOP/8);
memset(c, 0, TOP/8);
for (i=3; i < TOP; i+=2)
if ((c[i>>4] & (1<<((i>>1) & 7)))==0 /*&& i<(1ULL<<32)*/)
for (j=i*i>>1; j<TOP; j+=i) c[j>>3] |= 1 << (j&7);
for (p2=2, p1=3, i=5; i < TOP; i+=2)
if ((c[i>>4] & (1<<((i>>1) & 7)))==0) {
s = p2 + p1 + i;
r = sqrt(s*2);
if (r*(r+1)==s*2) printf("%llu, ", r);
p2 = p1, p1 = i;
}
return 0;
}
(PARI) upto(n) = {my(res = List(), t = 10); for(i = 5, n, c = t/3; p = nextprime(ceil(c)); q = precprime(p - 1); r = t - p - q; if(isprime(r) && nextprime(r + 1) == q || nextprime(p + 1) == r, listput(res, i - 1)); t+=i); res}
CROSSREFS
Cf. A167788 (the corresponding triangular numbers).
Smallest of three consecutive primes whose average is a triangular number.
+10
5
18713, 27253, 35227, 45433, 138587, 251677, 283861, 425489, 462221, 463189, 486583, 634493, 694409, 826211, 943231, 1103341, 1163557, 1181927, 1214453, 1282387, 1462891, 1509439, 1925681, 1931569, 2425487, 2970689, 3041803, 3324323, 3605939, 3627451, 4096933, 5140781
PROG
(C)
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define TOP (1ULL<<30)
int main() {
unsigned long long i, j, p1, p2, r, s;
unsigned char *c = (unsigned char *)malloc(TOP/8);
memset(c, 0, TOP/8);
for (i=3; i < TOP; i+=2)
if ((c[i>>4] & (1<<((i>>1) & 7)))==0 /*&& i<(1ULL<<32)*/)
for (j=i*i>>1; j<TOP; j+=i) c[j>>3] |= 1 << (j&7);
for (p2=2, p1=3, i=5; i < TOP; i+=2)
if ((c[i>>4] & (1<<((i>>1) & 7)))==0) {
s = p2 + p1 + i;
if ((s%3)==0) {
s/=3;
r = sqrt(s*2);
if (r*(r+1)==s*2) printf("%llu, ", p2);
}
p2 = p1, p1 = i;
}
return 0;
}
Smallest of five consecutive primes whose sum is a square.
+10
4
181, 199, 317, 3529, 3733, 4177, 4663, 9049, 15329, 15991, 19577, 24907, 43607, 47017, 58073, 84223, 86843, 146191, 152417, 156623, 175543, 217559, 227671, 288461, 308999, 323077, 331249, 333323, 354301, 390289, 397037, 407249, 474923, 476137, 491059, 520339
EXAMPLE
a(4) = 3529. The next four primes are 3533, 3539, 3541, and 3547, and the sum of all five primes = 17689 = 133^2.
MAPLE
count:= 0: Res:= NULL:
for y from 10 while count < 100 do
target:= y^2;
t:= prevprime(ceil(target/5));
s:= prevprime(t);
r:= prevprime(s);
q:= prevprime(r);
p:= prevprime(q);
u:= p+q+r+s+t;
while u < target do
p:= q; q:= r; r:= s; s:= t; t:= nextprime(t);
u:= p+q+r+s+t;
od;
if u = target then
count:= count+1; Res:= Res, p;
fi
od:
MATHEMATICA
Transpose[Select[Partition[Prime[Range[80000]], 5, 1], IntegerQ[Sqrt[ Total[#]]]&]][[1]]
Smallest of three consecutive primes whose sum is a triangular number.
+10
3
2, 3, 619, 1123, 3373, 4603, 6829, 9067, 18973, 25933, 29179, 29741, 33211, 40583, 48313, 72923, 74923, 117991, 130973, 202201, 231067, 253993, 255217, 267317, 291491, 339139, 346309, 363829, 423191, 449621, 476279, 489337, 519487, 533713, 539093, 592507, 602603, 621133
MAPLE
R:= 2: count:= 1:
for k from 1 while count < 100 do
for j from 1 to 2 do
m:= 4*k+j;
x:= m*(m+1)/2;
q= prevprime(ceil(x/3));
p:= prevprime(q); r:= nextprime(q);
t:= p+q+r;
if t < x then while t < x do p:= q; q:= r; r:= nextprime(r); t:=p+q+r od
elif t > x then while t > x do r:= q; q:= p; p:= prevprime(p); t:= p+q+r od
fi;
if t = x then R:= R, p; count:= count+1; fi
od od :
PROG
(C)
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define TOP (1ULL<<30)
int main() {
unsigned long long i, j, p1, p2, r, s;
unsigned char *c = (unsigned char *)malloc(TOP/8);
memset(c, 0, TOP/8);
for (i=3; i < TOP; i+=2)
if ((c[i>>4] & (1<<((i>>1) & 7)))==0 /*&& i<(1ULL<<32)*/)
for (j=i*i>>1; j<TOP; j+=i) c[j>>3] |= 1 << (j&7);
for (p2=2, p1=3, i=5; i < TOP; i+=2)
if ((c[i>>4] & (1<<((i>>1) & 7)))==0) {
s = p2 + p1 + i;
r = sqrt(s*2);
if (r*(r+1)==s*2) printf("%llu, ", p2);
p2 = p1, p1 = i;
}
return 0;
}
CROSSREFS
Cf. A167788 (the resulting triangular numbers).
Smallest of three consecutive primes whose average is a square.
+10
3
2393, 25913, 47951, 123191, 131759, 219953, 330611, 356387, 450227, 769117, 826271, 870479, 1026143, 1500613, 1515347, 1697797, 1846861, 1907141, 2013541, 2217107, 2486873, 2732383, 3229189, 3294191, 3956101, 4338871, 4481677, 4739297, 5022067, 5239511, 5294591, 5774387
MATHEMATICA
Select[Partition[Prime[Range[400000]], 3, 1], IntegerQ[Sqrt[Mean[#]]]&][[All, 1]] (* Harvey P. Dale, Jan 10 2021 *)
PROG
(C)
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define TOP (1ULL<<30)
int main() {
unsigned long long i, j, p1, p2, r, s;
unsigned char *c = (unsigned char *)malloc(TOP/8);
memset(c, 0, TOP/8);
for (i=3; i < TOP; i+=2)
if ((c[i>>4] & (1<<((i>>1) & 7)))==0 /*&& i<(1ULL<<32)*/)
for (j=i*i>>1; j<TOP; j+=i) c[j>>3] |= 1 << (j&7);
for (p2=2, p1=3, i=5; i < TOP; i+=2)
if ((c[i>>4] & (1<<((i>>1) & 7)))==0) {
s = p2 + p1 + i;
if ((s%3)==0) {
s/=3;
r = sqrt(s);
if (r*r==s) printf("%llu, ", p2);
}
p2 = p1, p1 = i;
}
return 0;
}
Numbers n such that n^2 is an average of three successive primes.
+10
2
49, 161, 219, 351, 363, 469, 575, 597, 671, 877, 909, 933, 1013, 1225, 1231, 1303, 1359, 1381, 1419, 1489, 1577, 1653, 1797, 1815, 1989, 2083, 2117, 2177, 2241, 2289, 2301, 2403, 2483, 2493, 2517, 2611, 2617, 2653, 2727, 2779, 2869, 2931, 3029, 3051, 3261, 3515, 3617
MATHEMATICA
Select[Sqrt[Mean[#]]&/@Partition[Prime[Range[10^6]], 3, 1], IntegerQ] (* Harvey P. Dale, Oct 23 2021 *)
PROG
(C)
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define TOP (1ULL<<30)
int main() {
unsigned long long i, j, p1, p2, r, s;
unsigned char *c = (unsigned char *)malloc(TOP/8);
memset(c, 0, TOP/8);
for (i=3; i < TOP; i+=2)
if ((c[i>>4] & (1<<((i>>1) & 7)))==0 /*&& i<(1ULL<<32)*/)
for (j=i*i>>1; j<TOP; j+=i) c[j>>3] |= 1 << (j&7);
for (p2=2, p1=3, i=5; i < TOP; i+=2)
if ((c[i>>4] & (1<<((i>>1) & 7)))==0) {
s = p2 + p1 + i;
if ((s%3)==0) {
s/=3;
r = sqrt(s);
if (r*r==s) printf("%llu, ", r);
}
p2 = p1, p1 = i;
}
return 0;
}
Search completed in 0.006 seconds
|