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.

A347982 a(n) is the greatest k, 0 < k < n, such that tau(k) = tau(n), or -1 if no such k exists, where tau is A000005.

Original entry on oeis.org

-1, -1, 2, -1, 3, -1, 5, 6, 4, 8, 7, -1, 11, 10, 14, -1, 13, 12, 17, 18, 15, 21, 19, -1, 9, 22, 26, 20, 23, 24, 29, 28, 27, 33, 34, -1, 31, 35, 38, 30, 37, 40, 41, 32, 44, 39, 43, -1, 25, 45, 46, 50, 47, 42, 51, 54, 55, 57, 53, -1, 59, 58, 52, -1, 62, 56, 61, 63, 65, 66, 67
Offset: 1

Views

Author

David James Sycamore, Sep 22 2021

Keywords

Comments

a(n) = -1 if and only if n is a term in A005179.

Examples

			a(1) = -1 because there is no positive number less than 1 having 1 divisor.
a(2) = -1 because 2 is the first prime.
a(3) = 2 because 2 is the greatest prime less than 3 and all primes have 2 divisors.
		

Crossrefs

Programs

  • Mathematica
    a[1] = -1; a[n_] := Module[{k = n - 1, d = DivisorSigma[0, n]}, While[k > 0 && DivisorSigma[0, k] != d, k--]; If[k == 0, -1, k]]; Array[a, 100] (* Amiram Eldar, Sep 23 2021 *)
  • PARI
    a(n) = my(nd=numdiv(n)); forstep(k=n-1, 1, -1, if (numdiv(k)==nd, return(k))); return(-1); \\ Michel Marcus, Sep 22 2021