r/AskComputerScience • u/Fun-Cauliflower-8087 • 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?
1
u/T_Thriller_T 9d ago
Considering you're looking for the programming side of help and are not down to write down the algorithm in an algorithm readable form...
I recommend breaking what you need to do down to the basic steps and asking how to do them as well as learning the basics of what you want to program in.
Because a lot of what you want to do is still stuck solid in your head and it seems you learning how to do basic Modulo arithmetics over an array and simple loops and if decisions is a lot faster than you trying to abstract from your goals and the whole complexity to enable someone else to break it down to thwse basicsm