Recursive function equals xmod3 for all x in N

In summary, the conversation discusses a suspicion that if f(0)=0, and f(x)=min(N\Uf(x-2^i)) where i runs from 0 to i=floor(ln(x)/ln(2)), then f(x)=xmod3 for all natural numbers, x. The speaker asks for help in proving this inductively and shares a proof sketch. The expert suggests strengthening the induction hypothesis and making a key observation to support the claim. The speaker thanks the expert and then introduces a new claim that f(x)= min(N\Uf(x-p)) where p is 1 or a prime less than or equal to x, and f(x)=xmod4. They ask if a similar inductive
  • #1
ama03630
2
0
I have a suspicion that if f(0)=0, and f(x)=min(N\Uf(x-2^i)) where i runs from 0 to i=floor(ln(x)/ln(2)), then f(x)=xmod3 for all natural numbers, x. Can anyone help me prove this inductively?
 
Mathematics news on Phys.org
  • #2
I'm not bothering to show the base cases as they are easy. I'm leaving out some detail here and just giving a proof sketch, but the general approach is as follows:
Strengthen the induction hypothesis slightly by claiming that [itex]f(y) \in \{0,1,2\}[/itex] in addition to [itex]f(y) \equiv y \pmod 3[/itex].
The key observation is that among,
[tex]x-2^0,x-2^1,x-2^2,\ldots[/tex]
no elements are congruent to [itex]x[/itex] modulo 3, but the first two represents the other two residue classes modulo 3. This means that if [itex]x=3k+a[/itex] where [itex]a\in\{0,1,2\}[/itex] and we assume that the hypothesis holds for all natural numbers less than x, then f(x-2^i) is never a, which means,
[tex]a \in \mathbb{N} \setminus \bigcup_{i=0}^{\left\lfloor \log_2(x)\right\rfloor} \{f\left(x-2^i\right)\}[/tex]
For x > 1 we have [itex]\{f(x-2^0),f(x-2^1),a\}=\{0,1,2\}[/itex] by our previous comments. This shows a is actually the minimum when x >1. So if you prove the theorem for x=0 and x =1, then you can inductively show f(3k+a)=a.
 
  • #3
It took me a little while, but I understand this now. Thank you very much for your help. Now, I claim f(x)= min(N\Uf(x-p)) where p is 1 or a prime less than or equal to x. Then, f(x)=xmod4. Do you think I could use a similar style of an inductive proof to prove this?
 

1. What is a recursive function?

A recursive function is a function that calls itself repeatedly until a certain condition is met. It is a common technique used in programming to solve problems that can be broken down into smaller, simpler versions of the same problem.

2. What does xmod3 mean?

xmod3 represents the remainder of x divided by 3. It is a mathematical operation that returns the remainder after dividing x by 3.

3. What is N in the context of this recursive function?

N stands for the set of natural numbers, which includes all positive integers (1, 2, 3, ...) and zero. In this context, the function is being applied to all natural numbers.

4. How does this recursive function work?

The recursive function equals xmod3 for all x in N works by repeatedly calling itself with smaller values of x until x reaches 0. Each time the function is called, it checks if x is divisible by 3. If it is, the function returns a value of 0. If not, it subtracts 1 from x and calls itself again. This process continues until x reaches 0, at which point the function returns the remainder of the original value of x divided by 3.

5. What is the purpose of this recursive function?

The purpose of this recursive function is to find the remainder of a given number when divided by 3. It can be used as a mathematical tool or as part of a larger algorithm or program.

Similar threads

Replies
3
Views
222
  • General Math
Replies
7
Views
497
  • General Math
Replies
4
Views
766
  • General Math
Replies
2
Views
723
Replies
3
Views
709
Replies
12
Views
1K
Replies
3
Views
771
Replies
4
Views
899
Replies
5
Views
845
Replies
4
Views
416
Back
Top