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.

A234335 Numbers k such that distances from k to three nearest squares are three perfect squares.

This page as a plain text file.
%I A234335 #7 Jul 03 2024 13:44:07
%S A234335 0,5,65,160,325,1025,2501,5185,5525,7200,9605,16385,26245,40001,40885,
%T A234335 58565,82945,93925,97920,114245,153665,160225,187200,202501,204425,
%U A234335 219385,262145,334085,419905,430625,521285,640001,707200,777925,781625,869465,937025,972725
%N A234335 Numbers k such that distances from k to three nearest squares are three perfect squares.
%C A234335 A subsequence of A234334.
%e A234335 5 is in the sequence because the following three are perfect squares: 5-4=1, 5-1=4, 9-5=4.
%e A234335 65 is in the sequence because the following three are perfect squares: 65-64=1, 65-49=16, 81-65=16, where 49, 64, 81 are the three squares nearest to 65.
%t A234335 ps3Q[n_]:=AllTrue[Take[Sort[Abs[n-(Floor[Sqrt[n]]+{-2,-1,0,1,2})^2]],3],IntegerQ[Sqrt[#]]&]; Join[ {0},Select[Range[2,10^6],ps3Q]] (* _Harvey P. Dale_, Jul 03 2024 *)
%o A234335 (C)
%o A234335 #include <stdio.h>
%o A234335 #include <math.h>
%o A234335 typedef unsigned long long U64;
%o A234335 U64 isSquare(U64 a) {
%o A234335   U64 r = sqrt(a);
%o A234335   return r*r==a;
%o A234335 }
%o A234335 int main() {
%o A234335   for (U64 n=0; ; ++n) {
%o A234335     U64 r = sqrt(n);
%o A234335     if (r*r==n && n)  --r;
%o A234335     if (isSquare(n-r*r) && isSquare((r+1)*(r+1)-n)) {
%o A234335       U64 rp = (r+2)*(r+2)-n;
%o A234335       r = n-(r-1)*(r-1);
%o A234335       if (n<=1 || rp<r)  r = rp;
%o A234335       if (isSquare(r))  printf("%llu, ", n);
%o A234335     }
%o A234335   }
%o A234335   return 0;
%o A234335 }
%Y A234335 Cf. A000290, A234334.
%K A234335 nonn
%O A234335 1,2
%A A234335 _Alex Ratushnyak_, Dec 23 2013