A226069
Primes p such that p-1 is a square and p-2 is a triangular number.
Original entry on oeis.org
2, 5, 17, 17957, 4726277, 23911673957
Offset: 1
-
#include
#include
#include
#define TOP (1ULL<<34)
int main() {
unsigned long long i, j, k, r, n=1;
unsigned char *c = (unsigned char *)malloc(TOP/8);
memset(c, 0, TOP/8);
for (i=3; i < TOP*2; i+=2)
if ((c[i>>4] & (1<<((i>>1) & 7)))==0) {
++n;
if (i<(1ULL<<32))
for (j=i*i>>1; j>3] |= 1 << (j&7);
}
//printf("%llu\n", n);
for (i=1, j=i*i+1; j < TOP*2; i++,j=i*i+1)
if(j==2 || ((j&1) && (c[j>>4] & (1<<((j>>1) & 7)))==0)) {
k = j-2;
r = sqrt(k*2);
if (r*r+r==k*2) printf("%9llu %9llu %9llu\n", r, i, j);
}
free(c);
return 0;
}
A226072
Primes p such that p-1 is a triangular number and p-2 is a square.
Original entry on oeis.org
2, 11, 11027, 16944049179227, 94511138700672573788068264540372768937231403134027
Offset: 1
-
import java.io.*;
import java.math.BigInteger;
public class A226072 {
public static void main (String[] args) throws Exception {
try {
BufferedReader in = new BufferedReader(
new FileReader(new File("b164055.txt")));
String line;
while ((line = in.readLine()) != null) {
BigInteger b = new BigInteger(line.split(" ")[1]);
b = b.add(BigInteger.ONE);
if (b.isProbablePrime(80))
System.out.printf("%s, ", b.toString());
}
} catch (Exception e) { e.printStackTrace(); }
}
}
-
Select[Prime[Range[1500]],OddQ[Sqrt[8(#-1)+1]]&&IntegerQ[Sqrt[#-2]]&] (* The program generates the first 3 terms of the sequence. *) (* Harvey P. Dale, Jul 20 2024 *)
A226070
Numbers k such that k^2-1 is a triangular number and k^2+1 is a prime.
Original entry on oeis.org
1, 2, 4, 134, 2174, 154634
Offset: 1
Indices of corresponding triangular numbers:
A226071.
A226071
Numbers k such that triangular(k)+1 is a square and triangular(k)+2 is a prime.
Original entry on oeis.org
0, 2, 5, 189, 3074, 218685
Offset: 1
Roots of corresponding squares:
A226070.
-
// see A226069.
-
Select[Range[0,220000],IntegerQ[Sqrt[(#(#+1))/2+1]]&&PrimeQ[(#(#+1))/2+2]&] (* Harvey P. Dale, Mar 01 2023 *)
A226073
Numbers k such that triangular(k)-1 is a square and triangular(k)+1 is a prime number.
Original entry on oeis.org
1, 4, 148, 5821348, 13748537282247342677718148, 49900608324196518198677680899235165296598423281799348
Offset: 1
Showing 1-5 of 5 results.
Comments