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.

A273190 a(n) is the number of nonnegative m < n for which m + n is a perfect square.

This page as a plain text file.
%I A273190 #38 Nov 26 2020 22:01:38
%S A273190 0,1,0,1,1,1,1,1,1,2,1,1,1,2,2,2,2,1,1,2,2,2,2,2,2,3,2,2,2,2,2,2,2,3,
%T A273190 3,3,3,2,2,2,2,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,4,4,4,4,3,3,3,
%U A273190 3,3,3,3,3,4,4,4,4,4,4,4,4,4
%N A273190 a(n) is the number of nonnegative m < n for which m + n is a perfect square.
%H A273190 Peter Kagey, <a href="/A273190/b273190.txt">Table of n, a(n) for n = 0..10000</a>
%F A273190 a(n) = floor(sqrt(2*n-1))-floor(sqrt(n-1)) for n > 0. - _Chai Wah Wu_, May 25 2016
%F A273190 a(n) = A103128(n) - A000196(n-1); after previous formula. - _Michel Marcus_, May 25 2016
%F A273190 a(n) = Sum_{i=1..n} c(2*n-i), where c is the square characteristic (A010052). - _Wesley Ivan Hurt_, Nov 26 2020
%e A273190 a(1) = 1 because 1 + 0 is a perfect square.
%e A273190 a(2) = 0 because neither 2 + 0 nor 2 + 1 are perfect squares.
%e A273190 a(5) = 1 because 5 + 4 is a perfect square.
%e A273190 a(9) = 2 because 9 + 0 and 9 + 7 are perfect squares.
%t A273190 Table[Count[Range[0, n - 1], m_ /; IntegerQ@ Sqrt[m + n]], {n, 0, 120}] (* _Michael De Vlieger_, May 18 2016 *)
%o A273190 (Java)
%o A273190 int n = 100;
%o A273190 int[] terms = new int[n];
%o A273190 for (int i = 0; i < n; i++) {
%o A273190      for (int j = 0; j < i; j++) {
%o A273190           if (Math.sqrt(i+j) == Math.floor(Math.sqrt(i+j))) {
%o A273190                terms[i]++;
%o A273190           }
%o A273190      }
%o A273190      System.out.print(terms[i] + ", ");
%o A273190 }
%o A273190 (PARI) a(n) = sum(k=0, n-1, issquare(n+k)); \\ _Michel Marcus_, May 18 2016
%o A273190 (Haskell) a273190 n = length $ filter (>=n) $ takeWhile (< 2 * n) $ map (^2) [1..] -- _Peter Kagey_, May 25 2016
%o A273190 (Python)
%o A273190 from gmpy2 import isqrt
%o A273190 def A273190(n):
%o A273190     return isqrt(2*n-1)-isqrt(n-1) if n > 0 else 0 # _Chai Wah Wu_, May 25 2016
%Y A273190 Cf. A273185, A273191.
%K A273190 easy,nonn
%O A273190 0,10
%A A273190 _Alec Jones_, May 17 2016