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.

A257993 Least gap in the partition having Heinz number n; index of the least prime not dividing n.

Original entry on oeis.org

1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 4, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 4, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 4, 1, 2, 1, 2, 1, 3
Offset: 1

Views

Author

Emeric Deutsch, May 18 2015

Keywords

Comments

The "least gap" of a partition is the least positive integer that is not a part of the partition. For example, the least gap of the partition [7,4,2,2,1] is 3.
We define the Heinz number of a partition p = [p_1, p_2, ..., p_r] as Product(p_j-th prime, j=1...r) (concept used by Alois P. Heinz in A215366 as an "encoding" of a partition). For example, for the partition [1, 1, 2, 4, 10] we get 2*2*3*7*29 = 2436.
In the Maple program the subprogram B yields the partition with Heinz number n.
Sum of least gaps of all partitions of m = A022567(m).
From Antti Karttunen, Aug 22 2016: (Start)
Index of the least prime not dividing n. (After a formula given by Heinz.)
Least k such that A002110(k) does not divide n.
One more than the number of trailing zeros in primorial base representation of n, A049345.
(End)
The least gap is also called the mex (minimal excludant) of the partition. - Gus Wiseman, Apr 20 2021

Examples

			a(18) = 3 because the partition having Heinz number 18 = 2*3*3 is [1,2,2], having least gap equal to 3.
		

References

  • G. E. Andrews and K. Eriksson, Integer Partitions, Cambridge Univ. Press, 2004, Cambridge.
  • Miklós Bóna, A Walk Through Combinatorics, World Scientific Publishing Co., 2002.

Crossrefs

Positions of 1's are A005408.
Positions of 2's are A047235.
The number of gaps is A079067.
The version for crank is A257989.
The triangle counting partitions by this statistic is A264401.
One more than A276084.
The version for greatest difference is A286469 or A286470.
A maximal instead of minimal version is A339662.
Positions of even terms are A342050.
Positions of odd terms are A342051.
A000070 counts partitions with a selected part.
A006128 counts partitions with a selected position.
A056239 adds up prime indices, row sums of A112798.
A073491 lists numbers with gap-free prime indices.
A238709 counts partitions by sum and least difference.
A333214 lists positions of adjacent unequal prime gaps.
A339737 counts partitions by sum and greatest gap.

Programs

  • Maple
    with(numtheory): a := proc (n) local B, q: B := proc (n) local nn, j, m: nn := op(2, ifactors(n)): for j to nops(nn) do m[j] := op(j, nn) end do: [seq(seq(pi(op(1, m[i])), q = 1 .. op(2, m[i])), i = 1 .. nops(nn))] end proc: for q while member(q, B(n)) = true do  end do: q end proc: seq(a(n), n = 1 .. 150);
    # second Maple program:
    a:= n-> `if`(n=1, 1, (s-> min({$1..(max(s)+1)} minus s))(
            {map(x-> numtheory[pi](x[1]), ifactors(n)[2])[]})):
    seq(a(n), n=1..100);  # Alois P. Heinz, May 09 2016
    # faster:
    A257993 := proc(n) local p, c; c := 1; p := 2;
    while n mod p = 0 do p := nextprime(p); c := c + 1 od: c end:
    seq(A257993(n), n=1..100); # Peter Luschny, Jun 04 2017
  • Mathematica
    A053669[n_] := For[p = 2, True, p = NextPrime[p], If[CoprimeQ[p, n], Return[p]]]; a[n_] := PrimePi[A053669[n]]; Array[a, 100] (* Jean-François Alcover, Nov 28 2016 *)
    Table[k = 1; While[! CoprimeQ[Prime@ k, n], k++]; k, {n, 100}] (* Michael De Vlieger, Jun 22 2017 *)
  • PARI
    a(n) = forprime(p=2,, if (n % p, return(primepi(p)))); \\ Michel Marcus, Jun 22 2017
  • Python
    from sympy import nextprime, primepi
    def a053669(n):
        p = 2
        while True:
            if n%p!=0: return p
            else: p=nextprime(p)
    def a(n): return primepi(a053669(n)) # Indranil Ghosh, May 12 2017
    
  • Scheme
    (define (A257993 n) (let loop ((n n) (i 1)) (let* ((p (A000040 i)) (d (modulo n p))) (if (not (zero? d)) i (loop (/ (- n d) p) (+ 1 i))))))
    ;; Antti Karttunen, Aug 22 2016
    

Formula

a(n) = A000720(A053669(n)). - Alois P. Heinz, May 18 2015
From Antti Karttunen, Aug 22-30 2016: (Start)
a(n) = 1 + A276084(n).
a(n) = A055396(A276086(n)).
A276152(n) = A002110(a(n)).
(End)
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 1 + Sum_{k>=1} 1/A002110(k) = 1.705230... (1 + A064648). - Amiram Eldar, Jul 23 2022
a(n) << log n/log log n. - Charles R Greathouse IV, Dec 03 2022

Extensions

A simpler description added to the name by Antti Karttunen, Aug 22 2016