Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

If anyone can help understand how i solve this Batmanacci The Fibonacci sequence can be defined as follows: fib1fib2fibn=1=1=fibn2+fibn1fib1=1fib2=1fibn=fibn2+fibn1 We get the sequence 1,1,2,3,5,8,13,21,1,1,2,3,5,8,13,21,. But

If anyone can help understand how i solve this

Batmanacci

The Fibonacci sequence can be defined as follows:

fib1fib2fibn=1=1=fibn2+fibn1fib1=1fib2=1fibn=fibn2+fibn1

We get the sequence 1,1,2,3,5,8,13,21,1,1,2,3,5,8,13,21,. But there are many generalizations of the Fibonacci sequence. One of them is to start with other numbers, like:

f1f2fn=5=4=fn2+fn1f1=5f2=4fn=fn2+fn1

And we get the sequence 5,4,9,13,22,35,57,5,4,9,13,22,35,57,. But what if we start with something other than numbers? Let us define the Batmanacci sequence in the following manner:

s1s2sn=N=A=sn2+sn1s1=Ns2=Asn=sn2+sn1

where ++ is string concatenation. Now we get the sequence N, A, NA, ANA, NAANA, .

Given NN and KK, what is the KK-th letter in the NN-th string in the Batmanacci sequence?

Input

Input consists of a single line containing two integers NN (1N1051N105) and KK (1K10181K1018). It is guaranteed that KK is at most the length of the NN-th string in the Batmanacci sequence.

Output

Output the KK-th letter in the NN-th string in the Batmanacci sequence.

Sample Input 1 Sample Output 1
7 7 
N

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mysql Examples Explanations Explain Examples

Authors: Harry Baker ,Ray Yao

1st Edition

B0CQK9RN2J, 979-8872176237

More Books

Students also viewed these Databases questions