Find the best solutions to your problems with the help of IDNLearn.com. Our experts provide timely and accurate responses to help you navigate any topic or issue with confidence.

2 starting terms of a diginacci sequence when the 2021st term is 11

Sagot :

Hello,

In a diginacci sequence, all term is the sum off digits of the 2 terms before.

Answer: 2,3

[tex]u_{-2}=1\\u_{-1}=1\\u_0=digit(u_{-2})+digit(u_{-1})=1+1=2\\u_1=1+2=3\\u_2=2+3=5\\u_3=3+5=8\\u_4=5+8=13\\u_5=8+1+3=12\\...\\u_{18}=11\\u_{19}=8\\u_{20}=10\\u_{21}=9\\u_{22}=10\\u_{23}=10\\u_{24}=2**********\\u_{25}=3**********\\2020=24*84+4\\u_{2020}=u_{4}=13\\[/tex]

We must begin with 13 , 10

Proof:

Dim a As Long, b As Long, c As Long, nb As Integer

a = 13

b = 10

nb = 1

Print nb, a

While nb < 2021

   nb = nb + 1

   c = somme&(a, b)

   a = b

   b = c

   '    Print nb, a

Wend

Print nb, a

End

Function somme& (a1 As Long, b1 As Long)

   Dim strA As String, strB As String, n As Long

   strA = LTrim$(Str$(a1))

   strB = LTrim$(Str$(b1))

   n = 0

   For i = 1 To Len(strA)

       n = n + Val(Mid$(strA, i, 1))

   Next i

   For i = 1 To Len(strB)

       n = n + Val(Mid$(strB, i, 1))

   Next i

   somme& = n

End Function