#include <iostream>
using namespace std;
int main()
{
int index = 0;
int val;
int x;
while (val != 0)
{
cin >> val;
for (index = 1; index < 32; index++)
{
x = val * index - index / index;
cout << x << " " << val << " " << index << endl;
cout << x % 4 << endl;
cout << x % 3 << endl;
cout << x % 2 << endl;
}
}
return 0;
}
Why is it that when the input is <1, 2, 3, 4...> every 31st index is encoded in an algorithm similar to input 1, which is just index - 1; but the pattern is:
of twelves (1-12, 12 -24) [000, 111, 220, 301, 010, 121, 200, 311, 020, 101, 211, 321] , [000, 111, 220, 301, 010...repeating for input <1>;
of 31st index: [1]200, 111, 020, 301, 210, 121, 000, 311, 220, 101, 010, 321, 200...[13]
Why is the relation similar and is there a reason for this in binary?
Edit: To clarify question, when you take the remainder of a certain integer, and the relation becomes specific to each incrementation...is the reason for this because of binary and how the semantic is based on implementing a way to converge integer value to binary value? I know that high-level programming is using hash and communicating within programs...but the main idea is for the integer value to be binary specific...is this a binary specific operation or just some random algorithm that shows patterns in numbers?