login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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).
0
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,2
FORMULA
a(n) = n^2 - A032742(n) if n is composite, n^2 otherwise.
a(n) = A000290(n) <=> n in { A008578 }.
EXAMPLE
For n = 10, the divisors of n are {1,2,5,10}. The largest nontrivial divisor is 5, so 10 * 10 - 5 = 95.
MATHEMATICA
Table[
Module[{divisors, largestNonTrivialDivisor},
divisors = Divisors[n];
largestNonTrivialDivisor = If[Length[divisors] > 2, divisors[[-2]], 0];
n^2 - largestNonTrivialDivisor
],
{n, 1, 20}
]
PROG
(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()
CROSSREFS
Relates to A364391 but uses n^2 instead of n.
Sequence in context: A004630 A073497 A244941 * A086192 A105503 A095169
KEYWORD
nonn
AUTHOR
Stephen Pearson, Jul 04 2024
STATUS
approved