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.

A364391 a(n) = n - (largest nontrivial divisor of n, or 0 if there is none).

Original entry on oeis.org

1, 2, 3, 2, 5, 3, 7, 4, 6, 5, 11, 6, 13, 7, 10, 8, 17, 9, 19, 10, 14, 11, 23, 12, 20, 13, 18, 14, 29, 15, 31, 16, 22, 17, 28, 18, 37, 19, 26, 20, 41, 21, 43, 22, 30, 23, 47, 24, 42, 25, 34, 26, 53, 27, 44, 28, 38, 29, 59, 30, 61, 31, 42, 32, 52, 33, 67, 34, 46, 35
Offset: 1

Views

Author

Todor Szimeonov, Jul 21 2023

Keywords

Examples

			The largest nontrivial divisor of 6 is 3, so a(6) = 6 - 3 = 3.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := n - If[CompositeQ[n], n/FactorInteger[n][[1, 1]], 0]; Array[a, 100] (* Amiram Eldar, Jul 22 2023 *)
  • Python
    from sympy import isprime, primefactors
    def A364391(n): return n if n==1 or isprime(n) else n-n//min(primefactors(n)) # Chai Wah Wu, Aug 20 2023

Formula

a(n) = n - A032742(n) if n is composite, n otherwise. - Jon E. Schoenfield, Jul 21 2023