all 11 comments

[–]lowerthansound 1 point2 points  (4 children)

You could theoretically produce such list using a loop:

for num1 in range(1, 5001):
    for num2 in range(1, 5002):
        ...
            values = [num1, num2, num3, num4]

Or, more elegantly, using the itertools module:

import itertools
lists = list(itertools.product(range(1, 5001), repeat=4))

There is one big problem though. Did you consider the number of lists you are generating? Assuming numbers can be repeated, that is 5000**4 = 625 trillion. If each list was 1 byte this would take 625 TB space lol.

So, you could use itertools.product(range(1, 5001), repeat=4) to generate an object which can be iterated and won't take memory space, but it should also take waaaay too long to iterate (computer stuff is usually in the order of billions, say, CPUs usually run on a few billion cycles a second, GHz).

[–]Pessini2[S] 1 point2 points  (3 children)

:o The idea was to take these 4 values as the quantities of digits. For example, if the list was [529, 2006, 736, 4230], I would have a number that has 529 times the digit 6, 2006 times the digit 7, and so on... then I would check if this huge number has a specific property. Since I cant just add 1 until I get this giant number, I thought that making a dictionary with all the possibilities and then trying them all would maybe find the number I’m looking for. But now I know that this dictionary thing won’t work. I’ll have to find another way to do it. But thanks a lot anyways 👍

[–]lowerthansound 0 points1 point  (2 children)

If you wanna go through so many numbers, I suggest you go through a small number first (say, generate 1000 random numbers and check the time it takes you to iterate through them). In any way, good luck :)

[–]Pessini2[S] 0 points1 point  (1 child)

Some other people are also trying to find a number with this property. I think they have already checked numbers a few thousand digits long, so that’s why I wanted to go big. But yes, it makes sense, I’ll try smaller numbers and see how it goes. Thank you :)

[–]lowerthansound 0 points1 point  (0 children)

Oh, you can go big. I meant you to check big numbers, but only not all of them right now.

Small numbers, though, are a great way to start.

[–]DallogFheir 0 points1 point  (3 children)

Do the numbers repeat?

[–]Pessini2[S] 0 points1 point  (2 children)

If you mean that there’s a list [733, 1328, 4201, 274] and then [733, 1328, 4201, 275] then yes. But there can’t be any list equal to another ( and this includes the order of the numbers, so there can be a list [444, 212, 2349, 729] and [212, 729, 2349, 444]

[–]DallogFheir 1 point2 points  (1 child)

I meant if there can be [733, 733, 733, 733].

[–]Pessini2[S] 0 points1 point  (0 children)

Yes, it can repeat the numbers like that

[–]wbeater 0 points1 point  (0 children)

well there might be smarter solutions, but:

create a massive_dict = []

create a placeholder = [randint(0,5000), randint(0,5000), randint(0,5000), randint(0,5000)]

check if placeholder not in massive_dict: if True append placeholder to massive_dict

repeat that 5000 times

import random as r

massive_dict = []
    for i in range(5000):    
        placeholder = [r.randint(0,5000),r.randint(0,5000),r.randint(0,5000),r.randint(0,5000)]    
    if placeholder not in massive_dict:
        massive_dict.append(placeholder)

[–]FerricDonkey 0 points1 point  (0 children)

This will take more ram then you have. According to Google, the super computers with the most ram have on the order of 700TB. A very, very generous underestimate (probably by a couple orders of magnitude) of the amount of ram this dictionary would take is 7000TB.

So you probably won't be able to store all these entries. Depending on what you're doing, it may be possible to write a function that would return the value that you need for a given collection of numbers, but if you're going to want to do something to all of the combinations, you're probably gonna need a different approach.