A257993 Least gap in the partition having Heinz number n; index of the least prime not dividing n.
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
Keywords
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.
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..20000
- George E. Andrews and David Newman, Partitions and the Minimal Excludant, Annals of Combinatorics, Volume 23, May 2019, Pages 249-254.
- P. J. Grabner and A. Knopfmacher, Analysis of some new partition statistics, Ramanujan J., 12, 2006, 439-454.
- Brian Hopkins, James A. Sellers, and Dennis Stanton, Dyson's Crank and the Mex of Integer Partitions, arXiv:2009.10873 [math.CO], 2020.
- Wikipedia, Mex (mathematics).
- Index entries for sequences related to primorial base.
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.
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.
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
From Antti Karttunen, Aug 22-30 2016: (Start)
a(n) = 1 + A276084(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
Comments