login
A020646
Least positive integer k for which 7^n divides k!.
4
1, 7, 14, 21, 28, 35, 42, 49, 49, 56, 63, 70, 77, 84, 91, 98, 98, 105, 112, 119, 126, 133, 140, 147, 147, 154, 161, 168, 175, 182, 189, 196, 196, 203, 210, 217, 224, 231, 238, 245, 245, 252, 259, 266, 273, 280, 287, 294, 294, 301, 308, 315, 322, 329, 336, 343, 343, 343, 350
OFFSET
0,2
REFERENCES
H. Ibstedt, Smarandache Primitive Numbers, Smarandache Notions Journal, Vol. 8, No. 1-2-3, 1997, 216-229.
MATHEMATICA
lpi[n_]:=Module[{k = 1, n7 = 7^n}, While[! Divisible[k!, n7], k++]; k]; Array[lpi, 60, 0] (* Harvey P. Dale, Jun 29 2017 *)
PROG
(PARI) a(n) = {k = 1; while (valuation(k!, 7) < n, k++); k; } \\ Michel Marcus, Aug 19 2013
(Python)
from itertools import count
from sympy import multiplicity
def A020646(n):
if n == 0: return 1
c = 0
for k in count(7, 7):
c += multiplicity(7, k)
if c+k+7 > n:
return 7*(max(k, n-c) if n>=7 else n+1-c) # Chai Wah Wu, Feb 24 2026
CROSSREFS
KEYWORD
nonn
STATUS
approved