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.

A372815 The square of n minus (the largest divisor d of n with 2 <= d <= m-1, or 0 if there is no such divisor).

This page as a plain text file.
%I A372815 #30 Jul 23 2024 21:24:02
%S A372815 1,4,9,14,25,33,49,60,78,95,121,138,169,189,220,248,289,315,361,390,
%T A372815 434,473,529,564,620,663,720,770,841,885,961,1008,1078,1139,1218,1278,
%U A372815 1369,1425,1508,1580,1681,1743,1849,1914,2010,2093,2209,2280,2394,2475,2584
%N A372815 The square of n minus (the largest divisor d of n with 2 <= d <= m-1, or 0 if there is no such divisor).
%F A372815 a(n) = n^2 - A032742(n) if n is composite, n^2 otherwise.
%F A372815 a(n) = A000290(n) <=> n in { A008578 }.
%e A372815 For n = 10, the divisors of n are {1,2,5,10}. The largest nontrivial divisor is 5, so 10 * 10 - 5 = 95.
%t A372815 Table[
%t A372815   Module[{divisors, largestNonTrivialDivisor},
%t A372815     divisors = Divisors[n];
%t A372815     largestNonTrivialDivisor = If[Length[divisors] > 2, divisors[[-2]], 0];
%t A372815     n^2 - largestNonTrivialDivisor
%t A372815   ],
%t A372815   {n, 1, 20}
%t A372815 ]
%o A372815 (Python)
%o A372815 def factors(n):
%o A372815     return sorted([i for i in range(2, n - 1) if n % i == 0])
%o A372815 def main():
%o A372815     for i in range(1, 20):
%o A372815         fs = factors(i)
%o A372815         if len(fs) == 0:
%o A372815             l = 0
%o A372815         else:
%o A372815             l = fs[-1]
%o A372815         print(i*i - l)
%o A372815 if __name__ == "__main__":
%o A372815     main()
%Y A372815 Relates to A364391 but uses n^2 instead of n.
%Y A372815 Cf. A000040, A000290, A008578, A032742, A160180.
%K A372815 nonn
%O A372815 1,2
%A A372815 _Stephen Pearson_, Jul 04 2024