login
Consider recurrence b(0) = (2n+1)/2, b(n) = b(0)*ceiling(b(n-1)); sequence gives first integer reached.
5

%I #17 Jun 30 2024 09:09:42

%S 3,20,14,468,33,299,60,47328,95,1218,138,25475,189,3161,248,20830128,

%T 315,6512,390,181138,473,11655,564,9015167,663,18974,770,671745,885,

%U 28853,1008,38906570560,1139,41676,1278,1799888,1425,57827,1580,110341278,1743,77690

%N Consider recurrence b(0) = (2n+1)/2, b(n) = b(0)*ceiling(b(n-1)); sequence gives first integer reached.

%C k = A001511(n) is the number of steps to reach an integer b(k).

%F a(n) = s*(n*s^k - 1/2) / (s-1) where s = b(0) = (2*n+1)/2 and k = A001511(n). - _Kevin Ryde_, Jun 30 2024

%p Digits := 100: c := ceil; A081849 := proc(a) local i,t0,t; t0 := a; t := 0; for i from 1 to 100 do if whattype(t0) <> integer then t0 := a*c(t0); t := t+1; else RETURN(t0); fi; od; RETURN('FAIL'); end;

%t a[n_]:=Module[{b=b0=(2n+1)/2},While[!IntegerQ[b],b=b0*Ceiling[b]]; b]; Array[a,42] (* _Stefano Spezia_, Jun 26 2024 *)

%o (Python)

%o from math import ceil

%o from fractions import Fraction

%o def a(n):

%o b0 = b = Fraction((2*n+1), 2)

%o while b.denominator != 1: b = b0*ceil(b)

%o return b.numerator

%o print([a(n) for n in range(1, 43)]) # _Michael S. Branicky_, Mar 20 2021

%o (PARI) a(n) = if(n==1,3, my(t=2*n+1, k=1+valuation(n,2)); n*t^(k+1) >>k \ (t-2)); \\ _Kevin Ryde_, Jun 30 2024

%Y Cf. A001511, A081853, A073524, A074078.

%K nonn,easy

%O 1,1

%A _N. J. A. Sloane_, Apr 13 2003