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.

A250480 a(1) = 0, and for n > 1: if n is a prime, a(n) = n, otherwise a(n) = A020639(n) - 1, where A020639(n) gives the least prime dividing n.

Original entry on oeis.org

0, 2, 3, 1, 5, 1, 7, 1, 2, 1, 11, 1, 13, 1, 2, 1, 17, 1, 19, 1, 2, 1, 23, 1, 4, 1, 2, 1, 29, 1, 31, 1, 2, 1, 4, 1, 37, 1, 2, 1, 41, 1, 43, 1, 2, 1, 47, 1, 6, 1, 2, 1, 53, 1, 4, 1, 2, 1, 59, 1, 61, 1, 2, 1, 4, 1, 67, 1, 2, 1, 71, 1, 73, 1, 2, 1, 6, 1, 79, 1, 2, 1, 83, 1, 4, 1, 2, 1, 89
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. also A005171 (characteristic function for nonprimes), A020639 (the smallest prime divisor of n).
Differs from A251758 for the first time at n = 2431 = 11*13*17, where a(2431) = 10, while A251758(2431) = 9.

Programs

  • Mathematica
    Join[{0},Table[If[PrimeQ[n],n,FactorInteger[n][[1,1]]-1],{n,2,100}]] (* Harvey P. Dale, Apr 14 2023 *)
  • Scheme
    (define (A250480 n) (if (prime? n) n (- (A020639 n) 1)))

Formula

a(n) = n for all prime n, and a(n) = A020639(n) - 1 for all composite n.
a(n) = A020639(n) - A005171(n).
Showing 1-1 of 1 results.