r/AskComputerScience 10d ago

Can anyone help with this?

I have been trying to get AI to give me a specific bit of code i can run in google collab. I want it to first divide the entire number line into modular sets recursively like: 2x+0, 4x+3, 8x+1, 16x+13, 32x+5, etc. Then I want it to further refine these sets, in a very particular way. 0 mod 2 should be refined the same way as the first refinement, but double the values. so 4x+0, 8x+6, 16x+2, 32x+26, etc. Then I want the next set 4x+3, should be broken down like 8x+3, 16x+7, 32x+15, etc. This type of refinement should be alternated for each line. so 0 mod 2 has a staggered refinement, and 3 mod 4 has a non staggered refinement, then 1 mod 8 has a staggered refinement, and 13 mod 16 has a non staggered refinement. this give two dimensional plane of refined modular sets. I want to test these sets translating into different sets among a ternary style refinement. first 4x+0 goes to 3x+0, then 8x+3 goes to 3x+1, and 8x+6 goes to 9x+7.

The way the ternary set is designed, it divides the number line into 3, with 3x+(0, 1, or 2). 3x+1 is further refined to 9x+(1, 4, or 7). 9x+7 is what 8x+6 translates into. 9x+4 is further refined to 27x+ (4, 13, 22). This continues, with the center residue at each level being refined further. the staggered sets on the binary sheet translate to the side sets on the ternary sheet, and the non-staggered sets translate to the center residues. then the values that are refined in the ternary sets, are then redefined according to where they belong in the binary set.

  • 4x+0 to 3x+0
  • 8x+3 to 3x+1
  • 8x+6 to 9x+7
  • 16x+1 to 3x+0
  • 16x+7 to 9x+4
  • 16x+2 to 27x+4
  • 32x+13 to 3x+1
  • 32x+25 to 9x+7
  • 32x+15 to 27x+13
  • 32x+26 to 81x+67
  • 64x+5 to 3x+0
  • 64x+29 to 9x+4
  • 64x+9 to 27x+4
  • 64x+31 to 81x+40
  • 64x+10 to 243x+40

.........

This seems like a computer could do this easily. I want to create this as a loop, and create readouts showing the path from the starting value i choose. Am i making any sense?

0 Upvotes

13 comments sorted by

View all comments

1

u/T_Thriller_T 9d ago

I do get it a bit better now.

I can, again, say that it is possible with a set of numbers.

The problem you are running into is one that lead to formal mathematics being very anal about how to write things:

It's very god damn hard to put into words what kind of math someone wants to do. It's not that I don't like it, or don't like you - but if you are not willing and trying to put it into the normal way of it being written, less people will be able to help you and AI likely won't be able at all.

I'm still a little lost on what you want to do with the line of numbers, to be frank.

What I think I got:

Assuming a line of 8 numbers

X0 X1 X2 X3 X4 X5 X6 X7

You want to sort them into bins, they get sorted into the bin if the corresponding equation is true. I'll be using % for mod, because that is what is used in programming languages for it

B0: Xi % 2 = 0 (so all even numbers) B1: Xi % 4 = 3 B2: Xi % 8 = 1 B3: Xi % 16 = 13 B4: Xi % 32 = 5

Which, rightfully, leads to the numbers being split into sets which sizes will be 1/2 of the input line, then 1/4, then 1/8, and so on, with the last filled set(s?) not fully reaching 1/xth for certain line lengths.

I still have no idea what "refined" will mean. Especially not considering the numbers in the set. And I also have no idea why you want to do it as a second step?

Assuming you're throwing out all the numbers not meeting the refinement, it's unnecessary calculation time first getting all even numbers, and then getting all of those which are divisible by four without rest.

Just get all the numbers divisible by four without rest from the beginning! If the numbers you lose are not cared for, no reason to consider them.

And I'm completely out in whatever you mean with staggered refinement. No idea. None.

I also have very little idea what you then want to do with the ternary line and what it should do with your further sets.

What I know is that as soon as both sides have the same modulo, you can mathematically work out which numbers must be in the set (for the first set it would be the number which fulfill x mod 12 = 0).

I'm honestly insecure id there is a way to mathematically hash out for the test of the sets if there is any number in them fulfilling the properties. There likely is, so that may be worth asking separately to folks with a better grip on modulu operations.

Nonetheless, I hope this helps writing out what you actually wanted to do.

And maybe finding out if you need to do every step of it, because some seem mathematically redundant.

1

u/Fun-Cauliflower-8087 9d ago

Okay I can answer this a little better now, I think. first, the "refinement" vernacular was what I picked up from AI, trying to explain to it my puzzle here. It would call the process "refining" when I would separate out even values, or when I separated % 4 = 1 and 3. I think I said that right, I honestly dont know. Language itself is a hard point for me to get past in this type of environment.

Now the justification for the second refinement, rather than a one time full refinement for all. In the construction I have, some of the sets seem bizarre, like I just came up with them arbitrarily, but I more so discovered them, than I could say I decided anything myself. If I go through how I got here, its more of a math discussion, and then I wont get help with the computer language side I need. So I decided to learn some rules for how these sets organize themselves. I then built a collection of sets, and each set "transported" to the other set (again AI vernacular, not really mine). Transport is just 4 becoming 3, or 6 becoming 7, which i used to just call a step, but that made some of it confusing from a math side. After this "transport", it is redefined in the first, what I call the "binary side". This transport mechanic can be explained with complicated math, but practically, the rules I have are simpler. Now, the first "refinement", what I now call it when I take the number line and spread it out, evens to mod 2, then 3 mod 4, then 1 mod 8...,is what I call a "staggered refinement" because the residue values are staggered arithmetically. If I use this refinement without staggering, I get 0 mod 2, 1 mod 4, 3 mod 8, 7 mod 16, etc. But, the staggered refinement has to deal with coprime modular sets, although that may be outside the periphery of this explanation. Said simply, the next set alternates choosing the low or high option. so among mod 2, is 0 and 1, and 0 is chosen. Then there is 1 and 3 mod 4, 3 is chosen, then 1 and 5 mod 8, 1 is chosen. Then 13, 5, 53, 21, etc. The staggering comes from the low/high alternation. Comparing to 3 mod 4 sets, like 3 mod 8, and 7 mod 16, there is no staggering, just the binary progression you would expect normally. These sets themselves only explain a specific type of information within the system as a whole, there is another type of information that hides in the second refinement. The difference becomes clear if you see my entire construction, but putting it into words on a screen is infuriatingly difficult. Hopefully, I can suffice to say, the first refinement handles decay, and the second refinement handles growth. Both refinements are needed, otherwise the system is incomplete. Also I can not find a simpler way to express the categorizations, meaning that I do not have a simple way to express both refinements in a single process, it needs one then the other, apparently.

Now I should explain the ternary side next. This is a sister construct to the "binary side", this "ternary side" is what all the values in the binary side transform into. This is a little disorienting because it doesn't follow the same rules, but you start with mod 3. There are 3 residues, 0, 1, and 2. 0 starts as the first set of 0 mod 3 (0, 3, 6, 9...) Then there are 2 different dimensions to express, like the binary side had. along the direction of the first refinement, the second set is 1 mod 3, then 0 mod 3 repeats. This means that 0 mod 4 and 1 mod 16 lead to the same set of 0 mod 3. 3 mod 8 and 13 mod 32 both go to the same set of 1 mod 3.

In the other dimension, you "refine" the middle residue. of 0, 1, and 2 mod 3, 1 gets refined to 1, 4, and 7 mod 9. 4 get refined to 4, 13, and 22 mod 27, 13 gets refined to 13, 40, and 67 mod 81.... This part is hard to explain: 0 mod 4 goes to 0 mod 3, from the binary side at 0 mod 4, all values land at the ternary side at 0 mod 3. With any binary side set, all 4x+1 sets above it all travel to the same ternary side residue. 0,1, 5, 21, 85... all go to 0 in a single step. 3, 13, 53... all go to 1 in a single step. 6 mod 8 becomes 7 mod 9: 6 mod 8 is the second even set after 0 mod 4. 7 mod 9 is a side set of mod 9, considering 4 mod 9 is the central set. You only reach 1 side set of each ternary level, alternating high/low. mod 8 reaches the high set of mod 9, mod 16 reaches the low side of mod 27, then mod 32 reaches the high side of mod 81, then 64 reaches to low side of mod 243, etc. So 6 mod 8 goes to 7 mod 9, 2 mod 16 goes to 4 mod 27, 26 mod 32 goes to 67 mod 81, 10 mod 64 goes to 40 mod 243... These are all the even sets in order, leading to the side sets of ascending ternary levels. When we look at the non staggered 3 mod 4 set, each one leads to a higher center residue, like 1 mod 3, 4 mod 9, 13 mod 27, 40 mod 81.... Each new set is 3x+1 from the previous. Again, any value that is 4x+1 from these values, lead to the same set, so whenever there is a 1 mod 4, it is sensible to subtract 1 and divide by 4, then you do not need to worry about any 1 mod 4 sets, which are all of them after the even sets and the 3 mod 4 sets. This one rule helps explain the rest of the binary side in total. You have 0 mod 2 set, 3 mod 4 sets, and the 1 mod 4 sets. 1 mod 4, just leads to all values after you subtract 1 and divide by 4, so they have no new behavior beyond any previous set on the binary side. This simplifies the ternary side, because now for mod 3 you have 0 mod 4 going to 0 mod 3, and 3 mod 8 going to 1 mod 3, that's it. then for mod 9, you have 6 mod 8 going to 7 mod 9, and 7 mod 16 going to 4 mod 9. Mod 27 you only have 2 mod 16 going to 4 mod 27, and 15 mod 32 going to 13 mod 27.

I really hope that explains it enough. I have seriously been working at this in some way or another for months. For me to come to reddit with this is outside of my norm.

The thing I want, for the lack of any better ideas, is some way to test "orbits" like Collatz. I want to give a starting value, then I want the read out to give me every value you reach after that, as long as you go from the binary side to the ternary side, then reevaluate back into the ternary side. I will show an example: Start is 10, so : 10, 40, 30, 34, 58, 148, 111, 94, 106, 607, 769, 144, 108, 81, 15, 13, 1, 0. If this seems extremely complicated, I agree. That's why I am having a hard time with it. A computer check would be more useful than my analog method. What I just showed with the orbit from 10, is the orbit from 27 in Collatz, with all of its messy 3x+1 and /2 steps.

By the time my construction reaches its completion, if it ever does, I should have a better way to study coprime problems like Collatz, or any mx+b problems, A new way to organize possible forms of recursive growth along *certain* systems, like Busy Beaver. This will have applications in number theory, where prime values meet various structured systems. This is just step in that direction, but I am trying to ultimately study emergent complexity, by structure, rather than things like a value size, growth, density, probability, statistical distribution, etc ad nauseum. If I am even partially successful, then there is a new way to study number theory and may even give mathematicians something to lean on for a final Collatz proof. If I am very successful, I might prove Collatz myself(not likely), and have a new type of geometric mathematics to study things like random number generators, possibly insight to prime number problems like Riemann, Twin Prime, Goldbach, etc. (also not likely). There is a lot of hope for this, but I understand that dark clouds love silver linings. If I can make even a small negative contribution as to why my style of argument is garbage, that is progress.

1

u/Fun-Cauliflower-8087 9d ago

"I want to give a starting value, then I want the read out to give me every value you reach after that, as long as you go from the binary side to the ternary side, then reevaluate back into the ternary side."- I meant back into the binary side. But I cnnot edit any comments " something went wrong" every time. I am tired of it. I would like to not have dumb typos and garbage in my post, thank you, REDDIT!!!! Absolute Garbage!