login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

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

%I #30 Jul 23 2024 21:24:02

%S 1,4,9,14,25,33,49,60,78,95,121,138,169,189,220,248,289,315,361,390,

%T 434,473,529,564,620,663,720,770,841,885,961,1008,1078,1139,1218,1278,

%U 1369,1425,1508,1580,1681,1743,1849,1914,2010,2093,2209,2280,2394,2475,2584

%N 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 a(n) = n^2 - A032742(n) if n is composite, n^2 otherwise.

%F a(n) = A000290(n) <=> n in { A008578 }.

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

%t Table[

%t Module[{divisors, largestNonTrivialDivisor},

%t divisors = Divisors[n];

%t largestNonTrivialDivisor = If[Length[divisors] > 2, divisors[[-2]], 0];

%t n^2 - largestNonTrivialDivisor

%t ],

%t {n, 1, 20}

%t ]

%o (Python)

%o def factors(n):

%o return sorted([i for i in range(2, n - 1) if n % i == 0])

%o def main():

%o for i in range(1, 20):

%o fs = factors(i)

%o if len(fs) == 0:

%o l = 0

%o else:

%o l = fs[-1]

%o print(i*i - l)

%o if __name__ == "__main__":

%o main()

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

%Y Cf. A000040, A000290, A008578, A032742, A160180.

%K nonn

%O 1,2

%A _Stephen Pearson_, Jul 04 2024