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.

A338101 Smallest odd prime dividing n is a(n)-th prime, or 0 if no such prime exists.

Original entry on oeis.org

0, 0, 2, 0, 3, 2, 4, 0, 2, 3, 5, 2, 6, 4, 2, 0, 7, 2, 8, 3, 2, 5, 9, 2, 3, 6, 2, 4, 10, 2, 11, 0, 2, 7, 3, 2, 12, 8, 2, 3, 13, 2, 14, 5, 2, 9, 15, 2, 4, 3, 2, 6, 16, 2, 3, 4, 2, 10, 17, 2, 18, 11, 2, 0, 3, 2, 19, 7, 2, 3, 20, 2, 21, 12, 2, 8, 4, 2, 22, 3, 2, 13, 23, 2, 3, 14, 2, 5, 24, 2
Offset: 1

Views

Author

Ilya Gutkovskiy, Nov 10 2020

Keywords

Examples

			70 = 2 * 5 * 7 = prime(1) * prime(3) * prime(4), 3 < 4, so a(70) = 3.
		

Crossrefs

Cf. A000079 (positions of 0's), A000265, A000720, A020639, A055396, A078701.

Programs

  • Maple
    f:= proc(n) local w;
       w:= numtheory:-factorset(n) minus {2};
       if w = {} then 0 else numtheory:-pi(min(w)) fi
    end proc:
    map(f, [$1..100]); # Robert Israel, Nov 13 2020
  • Mathematica
    Array[If[Or[# == 1, ! IntegerQ@ #], 0, PrimePi@ #] &@ SelectFirst[FactorInteger[#][[All, 1]], OddQ] &, 90] (* Michael De Vlieger, Nov 13 2020 *)
  • PARI
    a(n) = my(v = select(x->((x%2)==1), factor(n)[, 1])); if (#v, primepi(vecmin(v)), 0); \\ Michel Marcus, Nov 13 2020

Formula

a(n) = A000720(A020639(A000265(n))).
a(n) = A000720(A078701(n)).