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

  • SEARCH
  • Home
  • 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 7885567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:06:18+00:00 2026-06-03T05:06:18+00:00

You are given a positive integer A. The goal is to construct the shortest

  • 0

You are given a positive integer A. The goal is to construct the shortest possible sequence of integers ending with A, using the following rules:

  1. The first element of the sequence is 1
  2. Each of the successive elements is the sum of any two preceding elements (adding a single element to itself is also permissible)
  3. Each element is larger than all the preceding elements; that is, the sequence is increasing.

For example, for A = 42, a possible solution is:

[1, 2, 3, 6, 12, 24, 30, 42]

Another possible solution for A = 42 is:

[1, 2, 4, 5, 8, 16, 21, 42]

After reading the problem statement, the first thing that came to my mind is dynamic programming (DP), hence I expressed it as a search problem and tried to write a recursive solution.

The search space up to A = 8 is:

                1
                |
                2
               / \
              /   \            
             3     4
            /|\   /|\
           / | \ 5 6 8
          /  |  \
         4   5   6
       /| |\  
      5 6 7 8

We can see that 4 occurs in two places, but in both cases the children of 4 are different. In one case the prior sequence is [1, 2, 4]. In the other case the prior sequence is [1, 2, 3, 4]. Therefore, we cannot say that we have overlapping sub-problems. Is there any way to apply DP to the above problem? Or I am wrong in judging that it can be solve using DP?

  • 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-06-03T05:06:19+00:00Added an answer on June 3, 2026 at 5:06 am

    This is an addition chain…

    http://en.wikipedia.org/wiki/Addition_chain

    There is no known algorithm which can calculate a
    minimal addition chain for a given number with any guarantees of
    reasonable timing or small memory usage. However, several techniques
    to calculate relatively short chains exist. One very well known
    technique to calculate relatively short addition chains is the binary
    method
    , similar to exponentiation by squaring. Other well-known
    methods are the factor method and window method.

    See also: New Methods For Generating Short Addition Chains in IEICE Transactions on Fundamentals of Electronics, Communications and Computer Sciences.

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

Sidebar

Related Questions

Given an array of positive integer, we need to exchange each element with first
Let A be an array of n positive integers, and k a given integer.
I had this question: Given an unsorted array of positive integers and an integer
Given a positive integer n, I want to generate all possible n bit combinations
Given a positive integer sequence of numbers in an array with common difference 2
Question: Given an unsorted array of positive integers, is it possible to find a
Given a positive integer N, we are allowed to apply any of the following
Given k positive integer numbers a 1 < a 2 < a 3 <
Given positive integers b, c, m where (b < m) is True it is
Consider this problem: You are given an array containing positive integers. All the integers

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.