A085058 a(n) = A001511(n+1) + 1.
2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 6, 2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 7, 2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 6, 2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 8, 2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 6, 2, 3, 2, 4, 2, 3, 2, 5, 2, 3, 2, 4, 2, 3, 2, 7, 2, 3, 2, 4, 2, 3, 2, 5, 2
Offset: 0
Links
- Antti Karttunen, Table of n, a(n) for n = 0..16383
- J. C. Lagarias and N. J. A. Sloane, Approximate squaring, Experimental Math., 13 (2004), 113-128.
Programs
-
Magma
[Valuation(n+1, 2)+2: n in [0..100]]; // Vincenzo Librandi, Jan 16 2016
-
Maple
f := x->(3/2)*ceil(x); g := proc(n) local t1,c; global f; t1 := f(n); c := 1; while not type(t1, 'integer') do c := c+1; t1 := f(t1); od; RETURN([c,t1]); end; a := n -> A001511(n+1) + 1: A001511 := n -> padic[ordp](2*n, 2): seq(a(n), n=0..104); # Johannes W. Meijer, Dec 22 2012
-
Mathematica
g = 3 Ceiling[ # ]/2 &; f[n_?OddQ] := Length @ NestWhileList[ g, g[n], !IntegerQ[ # ] & ]; Table[ f[n], {n, 1, 210, 2}]
-
PARI
A085058(n)=if(n<0,0,c=2*n+7/2; x=0; while(frac(c)>0,c=3/2*floor(c); x++); x) \\ Benoit Cloitre, Sep 27 2003
-
PARI
A085058(n)=if(n<0,0,c=(2*n+1)*3/2; x=1; while(frac(c)>0,c=3/2*ceil(c); x++); x) \\ Benoit Cloitre, Sep 27 2003
-
PARI
a(n) = valuation(n+1,2)+2; \\ Michel Marcus, Jan 15 2016
-
Python
def A085058(n): return (~(n+1) & n).bit_length()+2 # Chai Wah Wu, Apr 14 2023
Formula
a(n) = A007814(5^(n+1) - 1). - Ivan Neretin, Jan 15 2016
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 3. - Amiram Eldar, Sep 13 2024
Extensions
Edited by Franklin T. Adams-Watters, Dec 09 2013
Comments