OFFSET
2,2
COMMENTS
a(n) < n.
n such that a(n) = n-1: 2, 3, 996, 3389, 149462.
FORMULA
a(n) = modlg(2^n, n) = floor(2^n / n^floor(n*logn(2))), where logn is the logarithm base n.
In the base-b representation of k, modlg(k,b) is the most significant digit: k = c0 + c1*b + c2*b^2 + ... + cn*b^n, cn = modlg(k,b), c0 = k mod b. - Alex Ratushnyak, Aug 30 2012
EXAMPLE
a(2) = floor(2^2 / 2^2) = 1,
a(3) = floor(2^3 / 3) = 2,
a(4)..a(9) are floor(2^n / n^2),
a(10)..a(15) are floor(2^n / n^3),
a(16)..a(22) are floor(2^n / n^4), and so on.
MATHEMATICA
Table[Floor[2^n/n^Floor[n Log[n, 2]]], {n, 2, 64}] (* Alonso del Arte, Aug 26 2012 *)
PROG
(Python)
import math
def modiv(a, b):
return a - b*(a//b)
def modlg(a, b):
return a // b**int(math.log(a, b))
for n in range(2, 100):
a = 2**n
print(modlg(a, n), end=', ')
(Magma) [Floor(2^n div n^Floor(n *Log(n, 2))): n in [2..100]]; // Vincenzo Librandi, Jan 09 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Aug 25 2012
STATUS
approved