login
a(0) = 0, a(1) = 1. For n >= 2, a(n) = a(n-1)/(n-1) if n-1 divides a(n-1); otherwise, a(n) = a(n-1) + a(n-2).
5

%I #89 Jun 26 2021 08:59:59

%S 0,1,1,2,3,5,1,6,7,13,20,2,22,24,46,70,116,186,302,488,790,1278,2068,

%T 94,2162,2256,4418,6674,11092,17766,28858,46624,1504,47,1551,1598,

%U 3149,4747,7896,12643,20539,33182,53721,86903,2021,88924,90945,179869,3827,183696

%N a(0) = 0, a(1) = 1. For n >= 2, a(n) = a(n-1)/(n-1) if n-1 divides a(n-1); otherwise, a(n) = a(n-1) + a(n-2).

%C a(n) = A000045(n) for n = 0,1,2,3,4,5 and a(n) = A139047(n-1) for n = 1,2,3,...,10. Also, a(n) = n for n = 0,1,5 and a(n) < n for n = 2,3,4,6,7,8,11.

%C The values of n for which n divides a(n) are given in A343456 and the corresponding quotients are given in A343457.

%C If r and s are consecutive terms from A343456, then a(r+1) will divide the terms a(r) through a(s). Proof: Clearly, a(r+1) divides itself. Since a(r+1) = a(r)/r implies that r = a(r)/a(r+1), a(r+1) divides a(r). So, a(r+2) = a(r+1)+a(r) is also divisible by a(r+1). Similarly, the remaining terms a(r+3) = a(r+2)+a(r+1) through a(s) = a(s-1)+a(s-2) will also be divisible by a(r+1). QED

%C Example: a(r) = a(43) = 86903 = 2021*43 = a(44)*(1*43+0)

%C a(44) = 2021 = 2021* 1 = a(44)*(0*43+1)

%C a(45) = 88924 = 2021*44 = a(44)*(1*43+1)

%C a(46) = 90945 = 2021*45 = a(44)*(1*43+2)

%C a(s) = a(47) = 179869 = 2021*89 = a(44)*(2*43+3).

%C Notice that the values b and c in a(43+k) = a(44)*(b*43+c) for k = 0,1,2,3,4 follow the extended Fibonacci sequence A212804. In general, any run of terms a(r) through a(s) between successive divisions will be given by a(r+k) = a(r+1)*(A212804(k)*r+A212804(k+1)) for k = 0,1,2,...,s-r.

%C 2 divides a(10) through a(32), 3 divides a(134) through a(144), 5 and 7 divide a(116) through a(140), and 11 divides a(89) through a(297). Conjecture: For any prime p, there exist r and s = k*p from A343456 for which p divides a(r) through a(s).

%H Alois P. Heinz, <a href="/A343376/b343376.txt">Table of n, a(n) for n = 0..5000</a>

%e a(2) = a(1)/1 = 1, a(3) = a(2)+a(1) = 2, a(4) = a(3)+a(2) = 3, a(5) = a(4)+a(3) = 5, a(6) = a(5)/5 = 1, a(7) = a(6)+a(5) = 6, ...

%p a:= proc(n) option remember; local q; `if`(n<2, n,

%p `if`(irem(a(n-1), n-1, 'q')=0, q, a(n-1)+a(n-2)))

%p end:

%p seq(a(n), n=0..50); # _Alois P. Heinz_, Apr 21 2021

%t Block[{a = {0, 1}}, Do[AppendTo[a, If[Mod[#, i] == 0, #/i, # + a[[-2]] ]] &@ a[[-1]], {i, 48}]; a] (* _Michael De Vlieger_, Apr 22 2021 *)

%o (PARI) lista(nn) = {my(va = vector(nn)); va[1] = 1; for (n=2, nn, if (va[n-1] % (n-1), va[n] = va[n-1] + va[n-2], va[n] = va[n-1]/(n-1));); concat(0, va);} \\ _Michel Marcus_, Apr 20 2021

%o (Python)

%o a = [0, 1]

%o print("0 0")

%o print("1 1")

%o for n in range (2,101):

%o if a[n-1] % (n - 1) == 0: a.append(a[n-1]//(n-1))

%o else: a.append(a[n-1] + a[n-2])

%o print(n, a[n]) # _Karl-Heinz Hofmann_, Apr 23 2021

%Y Cf. A000045, A139047, A147316, A212804, A343456, A343457.

%K nonn

%O 0,4

%A _Timothy L. Tiffin_, Apr 13 2021