Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 799827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:11:38+00:00 2026-05-14T23:11:38+00:00

I need to write a function to satisfy this input -> output list: 0

  • 0

I need to write a function to satisfy this input -> output list:

0 -> 0
1 -> 1
3 -> 2
4 -> 3
5 -> 5
7 -> 13
9 -> 34

f(x) = ??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T23:11:39+00:00Added an answer on May 14, 2026 at 11:11 pm

    Well, that is incredibly easy… if you aren’t concerned about over-fitting, then you can do:

    switch(input)
         case 0: report 0
         case 1: report 1
         case 3: report 2
         ...
         default: report whatever
    

    You probably need more constraints on the problem if you want a good solution. You also might consider graphing the function to see if there is any obvious pattern, or maybe show the bits involved. It would also be useful to know if the inputs and outputs are integer-valued or real-valued (is the function supposed to be continuous or discrete?). Without this information, it’s a little bit hard to help.

    Edit
    Showing the missing numbers helps:

    0 -> 0
    1 -> 1
    2 -> 1
    3 -> 2
    4 -> 3
    5 -> 5
    6 -> 8
    7 -> 13
    8 -> 21
    9 -> 34

    (It’s the Fibonnaci numbers: f(x) = f(x-1)+f(x-2), where f(0)=0 and f(1)=1).

    PS
    This is a function for which dynamic programming or memoization is particularly useful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 535k
  • Answers 535k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The error is coming from the fetchedResults array of the… May 17, 2026 at 1:14 am
  • Editorial Team
    Editorial Team added an answer You're probably going to need to take a look at… May 17, 2026 at 1:14 am
  • Editorial Team
    Editorial Team added an answer You can use the sumif() function: SumIf( range, criteria, sum_range… May 17, 2026 at 1:14 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I need to write a function that takes 4 bytes as input, performs a
I need to write a function which will detect if the input contains at
i need to write a function which calculates how many elements on list with
I need to write a function that will take a variable number of arguments.
I need to write a function to parse variables which contain domain names. It's
I need to write a function that accepts an object , but I want
I need to write a function that is passed an instance of a CharField.
I need to write a function to delete the login in the database if
I need to write authentication function with asynchronous callback from remote Auth API. Simple
I need to write a function which could create any type object. It receives

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.