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 64369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:46:45+00:00 2026-05-10T18:46:45+00:00

Is there a practical algorithm that gives multiplication chains To clarify, the goal is

  • 0

Is there a practical algorithm that gives ‘multiplication chains’

To clarify, the goal is to produce a multiplication change of an arbitrary and exact length
Multiplication chains of length 1 are trivial.

A ‘multiplication chain’ would be defined as 2 numbers, {start} and {multiplier}, used in code:

 Given a pointer to array of size [{count}]   // count is a parameter  a = start;  do   {       a = a * multiplier;  // Really: a = (a * multiplier) MOD (power of 2       *(pointer++) = a;     }  while (a != {constant} )  // Postcondition:  all {count} entries are filled.   

I’d like to find a routine that takes three parameters
1. Power of 2
2. Stopping {constant}
3. {count} – Number of times the loop will iterate

The routine would return {start} and {multiplier}.

Ideally, a {Constant} value of 0 should be valid.

Trivial example:

power of 2 = 256   stopping constant = 7 number of times for the loop = 1   returns {7,1}  

Nontrivial example:

power of 2 = 256   stopping constant = 1 number of times for the loop = 49 returns {25, 19}   

The maximum {count} for a given power of 2 can be fairly small.
For example, 2^4 (16) seems to be limited to a count of 4

  • 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. 2026-05-10T18:46:45+00:00Added an answer on May 10, 2026 at 6:46 pm

    Here is a method for computing the values for start and multiplier for the case when constant is odd:

    1. Find such odd m (m = multiplier) that order of m modulo 2^D is at least count, meaning that smallest n such that m^n = 1 (mod 2^D) is at least count. I don’t know any other way to find such m than to make a random guess, but from a little experimenting it seems that half of odd numbers between 1 and 2^D have order 2^(D-2) which is maximal. (I tried for D at most 12.)

    2. Compute x such that x * m^count = 1 (mod 2^D) and set start = x * constant (mod 2^D).

    Such x can be found with ‘extended euclidean algorithm’: Given a and b with no common divisor, it gives you x and y such that a * x + b * y = 1. Here a=m^count mod 2^D and b = 2^D.

    edit: If constant happens to be even, you can divide it with a power of 2, say 2^k, to make in odd, then do the above for input {constant/2^k, count, 2^(D-k)} and finally return {start*2^k,multiplier}.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Yes, it is a more general .NET "best practice" to… May 11, 2026 at 4:21 pm
  • Editorial Team
    Editorial Team added an answer From the information given, the exception should come from this… May 11, 2026 at 4:21 pm
  • Editorial Team
    Editorial Team added an answer Did you see Karen Corby's talk at Mix09 online? Around… May 11, 2026 at 4:21 pm

Related Questions

I went through a period of being interested in how quantum computers work and
I've seen a few questions and answers on SO suggesting that MD5 is less
I'm familiar with the algorithm for reading a single random line from a file
I can't use boost:hash because I have to stick with C and can't use

Trending Tags

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

Top Members

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.