cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A226069 Primes p such that p-1 is a square and p-2 is a triangular number.

This page as a plain text file.
%I A226069 #8 Jan 30 2014 13:09:05
%S A226069 2,5,17,17957,4726277,23911673957
%N A226069 Primes p such that p-1 is a square and p-2 is a triangular number.
%C A226069 Roots of squares: a(n)-1 = b(n)*b(n), b(n) = A226070(n).
%C A226069 Roots of triangular numbers: a(n)-2 = c(n)*(c(n)+1)/2, c(n) = A226071(n).
%C A226069 Primes of the form A006452(k)^2+1. a(7) is too large to include here (see b-file). - _Max Alekseyev_, Jan 30 2014
%H A226069 Max Alekseyev, <a href="/A226069/b226069.txt">Table of n, a(n) for n = 1..12</a>
%o A226069 (C)
%o A226069 #include <stdio.h>
%o A226069 #include <stdlib.h>
%o A226069 #include <math.h>
%o A226069 #define TOP (1ULL<<34)
%o A226069 int main() {
%o A226069   unsigned long long i, j, k, r, n=1;
%o A226069   unsigned char *c = (unsigned char *)malloc(TOP/8);
%o A226069   memset(c, 0, TOP/8);
%o A226069   for (i=3; i < TOP*2; i+=2)
%o A226069     if ((c[i>>4] & (1<<((i>>1) & 7)))==0) {
%o A226069       ++n;
%o A226069       if (i<(1ULL<<32))
%o A226069         for (j=i*i>>1; j<TOP; j+=i)  c[j>>3] |= 1 << (j&7);
%o A226069     }
%o A226069   //printf("%llu\n", n);
%o A226069   for (i=1, j=i*i+1; j < TOP*2; i++,j=i*i+1)
%o A226069     if(j==2 || ((j&1) && (c[j>>4] & (1<<((j>>1) & 7)))==0)) {
%o A226069       k = j-2;
%o A226069       r = sqrt(k*2);
%o A226069       if (r*r+r==k*2) printf("%9llu %9llu %9llu\n", r, i, j);
%o A226069     }
%o A226069   free(c);
%o A226069   return 0;
%o A226069 }
%Y A226069 Cf. A226070-A226074.
%K A226069 nonn
%O A226069 1,1
%A A226069 _Alex Ratushnyak_, May 25 2013
%E A226069 Terms a(7)-a(12) from _Max Alekseyev_, Jan 30 2014