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.

Showing 1-1 of 1 results.

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).

Original entry on oeis.org

1, 4, 9, 14, 25, 33, 49, 60, 78, 95, 121, 138, 169, 189, 220, 248, 289, 315, 361, 390, 434, 473, 529, 564, 620, 663, 720, 770, 841, 885, 961, 1008, 1078, 1139, 1218, 1278, 1369, 1425, 1508, 1580, 1681, 1743, 1849, 1914, 2010, 2093, 2209, 2280, 2394, 2475, 2584
Offset: 1

Views

Author

Stephen Pearson, Jul 04 2024

Keywords

Examples

			For n = 10, the divisors of n are {1,2,5,10}. The largest nontrivial divisor is 5, so 10 * 10 - 5 = 95.
		

Crossrefs

Relates to A364391 but uses n^2 instead of n.

Programs

  • Mathematica
    Table[
      Module[{divisors, largestNonTrivialDivisor},
        divisors = Divisors[n];
        largestNonTrivialDivisor = If[Length[divisors] > 2, divisors[[-2]], 0];
        n^2 - largestNonTrivialDivisor
      ],
      {n, 1, 20}
    ]
  • Python
    def factors(n):
        return sorted([i for i in range(2, n - 1) if n % i == 0])
    def main():
        for i in range(1, 20):
            fs = factors(i)
            if len(fs) == 0:
                l = 0
            else:
                l = fs[-1]
            print(i*i - l)
    if _name_ == "_main_":
        main()

Formula

a(n) = n^2 - A032742(n) if n is composite, n^2 otherwise.
a(n) = A000290(n) <=> n in { A008578 }.
Showing 1-1 of 1 results.