Non-Random Number Generator

A

anuxuri

Guest
If someone wanted to generate a complete series of possible number combinations each consisting of a string of 7 integers <10 with a sum of any given whole number <=63, how could these numbers be generated using an expression?

e.g. given the sum of 5:
...
0212000
0220001
0220010
0220100
0221000
0230000
0300002
0300011
...
edited to conform with JeffM's novel realization
 
Last edited:
Please reply with the exact text of, and instructions for, the exercise. Please include the definitions you've been given to use, so that we can understand how, for instance, "0212000" is "an integer" which is regarded as being "less than 10". Thank you! ;)
 
There are no instructions, nor an exercise, merely genuine fascination and a search for understanding. However for the sake of example lets assume each 7 digit number set is a serial number on a gift certificate with one means of authentication being the sum of all digits is equal to a "seed" value. Given that it is a "gift certificate" multiple unique sets of numbers represented with 7 digits and with a sum of the "seed" need to be generated.

For instance within the serial number "0212000," each integer is separated from the set to form the string 0,2,1,2,0,0,0 with the sum of all digits totaling 5.

As an experiment I took 5 as a seed and manually generated 459 unique 7 digit "serial combinations" by taking the terms:
5
4+1
3+2
3+1+1
2+2+1
2+1+1+1
1+1+1+1+1

First, an equation for determining the total number of possible unique 7 digit serial number combinations with a given seed would be useful for double checking manual results. Second, an openoffice.org calc function which results in a series of unique serial numbers, with the only input being the seed value, would be extremely useful if possible.

This isn't for me, it is for everyone with the internet. Thank you for your contribution to cumulative human knowledge!
 
Last edited:
There are no instructions, nor an exercise, merely genuine fascination and a search for understanding. However for the sake of example lets assume each 7 digit number set is a serial number on a gift certificate with one means of authentication being the sum of all digits is equal to a "seed" value. Given that it is a "gift certificate" multiple unique sets of numbers represented with 7 digits and with a sum of the "seed" need to be generated.

For instance within the serial number "0212000," each integer is separated from the set to form the string 0,2,1,2,0,0,0 with the sum of all digits totaling 5.

As an experiment I took 5 as a seed and manually generated 459 unique 7 digit "serial combinations" by taking the terms:
5
4+1
3+2
3+1+1
2+2+1
2+1+1+1
1+1+1+1+1

First, an equation for determining the total number of possible unique 7 digit serial number combinations with a given seed would be useful for double checking manual results. Second, an openoffice.org calc function which results in a series of unique serial numbers, with the only input being the seed value, would be extremely useful if possible.

This isn't for me, it is for everyone with the internet. Thank you for your contribution to cumulative human knowledge!
You are not explaining what you want to do very clearly.

Consider 9, 9, 9, 9, 9, 9, 9. When I add those together I get 63. I can't sum to a higher "seed." Moreover, there is only one way to generate that sum from 7 digits. For a "seed" of 62, there are 7 ways. I am not sure whether there is a simple formula to compute such answers, but there undoubtedly are algorithms that can do so.

If you are asking us to devise and test such an algorithm, I think you are asking for more help than we can give. But I suspect you are asking a different question, one that you have not carefully defined and that will require a relatively sophisticated algorithm.
 
Thanks JeffM, I edited my first post to define the seed number as <=63 for this example. This could be represented as (s<=9n) where n is the number of digits of the serial to be generated and s is the value of the seed. It does seem like you understand what I'm trying to accomplish, the reason of which is as relevant as filling a few notebook pages with every whole number from 1 to 1048575 in binary each with 20 significant digits.

On the topic of algorithms and mathematics in general, I'm not extremely well versed, so there may very well be an algorithm for this purpose already in existence. I guess my problem is I'm looking for the answers without knowing the ideal defined question, that's why I'm here and not just using a search engine, to gain that understanding with the help of many minds. So instead of an answer to the question, I need a question to the answer, Jeopardy style.
 
Thanks JeffM, I edited my first post to define the seed number as <=63 for this example. This could be represented as (s<=9n) where n is the number of digits of the serial to be generated and s is the value of the seed. It does seem like you understand what I'm trying to accomplish, the reason of which is as relevant as filling a few notebook pages with every whole number from 1 to 1048575 in binary each with 20 significant digits.

On the topic of algorithms and mathematics in general, I'm not extremely well versed, so there may very well be an algorithm for this purpose already in existence. I guess my problem is I'm looking for the answers without knowing the ideal defined question, that's why I'm here and not just using a search engine, to gain that understanding with the help of many minds. So instead of an answer to the question, I need a question to the answer, Jeopardy style.
I am not capable of providing you much help. Perhaps denis is.

First, I'll try to formulate your questions for you.

(1) How many permutations of n decimal digits (0 through 9) add exactly to a given non-negative s <= 9n?

(2) What are those permutations?

There probably is a formula for answering the first question. To find it, however, you will need someone more knowledgeable about combinatorics than I am. I am highly confident that there is no formula for generating answers to your second question.

A formula is just a very simple kind of algorithm, which is any systematic method guaranteed to find correct answers in finite time. I am quite confident that there are algorithms for answering both questions. The brute force algorithm would simply loop through the 10^n possible permutations, list all that add to s, and keep a running total of the number of possibilities in the list. As n gets large, however, such an algorithm will become more and more time consuming. Consequently, it may not be practical. Making algorithms efficient is an art, not a science, and I am no artist.
 
Thank you for giving me words to explain my thoughts and shedding light on the darkened areas of my mind. I will explore deeper into algorithms, permutations, combinatorics and brush off my lamp to run some experimental java. And in case anyone is interested I will keep everyone posted on my "work of art."
 
Top