Coloring each k-th unit in a circle of n units

AI Thread Summary
The discussion centers on a mathematical problem involving coloring numbers arranged in a circle based on a step size k. When the greatest common divisor (gcd) of n (the total numbers) and k is 1, all numbers in the circle are colored. If k divides n, the number of colored units x equals n/k. For cases where gcd(n, k) is greater than 1, such as n=10 and k=8, the number of colored units can be determined by dividing n by gcd(n, k). In this example, gcd(10, 8) is 2, leading to x being 10 divided by 2, resulting in 5 colored numbers. The discussion highlights the importance of understanding the relationship between n, k, and their gcd to determine the number of colored units effectively.
yetam60389
Messages
2
Reaction score
0
TL;DR Summary
N numbers in a circle, coloring each k-th one.
suppose you write, clockwise, n numbers (or "units", doesn't matter) in a circle. you then color, clockwise, each k-th number. you do this until you've colored all n numbers, or until you've reached an already colored number. let x be the number of colored numbers.
i've figured that if gcd(n,k)=1, if they're coprime, the whole circle is colored.
furthermore, if k divides n, then x=n/k.

n=10, k=7, then x=10

n=10, k=5, then x=2

tho, what if they're not?
n=10, k=8, then x=5. from where does this 5 arise?

i swear I've solved this before but i just can't find the answer within my brain now.

thanks for any help!
 
Technology news on Phys.org
yetam60389 said:
n=10, k=8, then x=5. from where does this 5 arise?
What is 10 divided by gcd(10, 8)?

You just need to generalize your analysis a bit.
 
PeterDonis said:
What is 10 divided by gcd(10, 8)?

You just need to generalize your analysis a bit.
figured it out in the meanwhile. you're right, i was quite slow in figuring that out.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Replies
27
Views
4K
3
Replies
100
Views
11K
Replies
25
Views
4K
2
Replies
60
Views
11K
Replies
51
Views
10K
Replies
3
Views
3K
3
Replies
102
Views
10K
Back
Top