DEV Community

dev.to staff
dev.to staff

Posted on

1

Daily Challenge #65- A Disguised Sequence

Given u0 = 1, u1 = 2 and the relation 6unun+1-5unun+2+un+1un+2 = 0 calculate un for any integer n >= 0.

Example:
fcn(n) returns un: fcn(17) -> 131072, fcn(21) -> 2097152

Note:
You can look at this as

-Purely algorithmic from the definition of u^n
-the second one - not at all mandatory, but as a compliment - is to get a bit your head around and find which sequence is hidden behind u^n


This challenge comes from g964 at CodeWars, who has licensed redistribution of this challenge under the 2-Clause BSD License!

Want to propose a challenge idea for a future post? Email yo+challenge@dev.to with your suggestions!

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

While many AI coding tools operate as simple command-response systems, Qodo Gen 1.0 represents the next generation: autonomous, multi-step problem-solving agents that work alongside you.

Read full post

Top comments (2)

Collapse
 
bb4l profile image
bb4L

for others not understanding the task, check out the link to the original: codewars.com/kata/563f0c54a22b9345...

6unun+15unun+2+un+1un+2=0 6u_n u_{n+1} - 5 u_n u_{n+2} + u_{n+1} u_{n+2}= 0
Collapse
 
shubhamkumar13 profile image
thirteenturtles

I didn't understand the recurrence relation. Is 6unun == 6*un*un?

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay