Finding i Given F[i] for a Given Equation

  • Thread starter Thread starter ged25
  • Start date Start date
Click For Summary
The equation F[i] = (F[i-1] * a) % b, with F[0] = 1, raises questions about determining i given F[i]. It is clarified that in some programming contexts, "a % b" refers to the integer part of a divided by b. There may be values of n for which F[i] does not equal n for any i, indicating that a general solution for F[i] = n may not exist. The sequence F[i] will repeat after at most b steps due to the limited number of possible values. To find potential i values for a given F[i], Euler's theorem can be applied, particularly when a and n are coprime.
ged25
Messages
6
Reaction score
0
I have the following equation

F = (F[i-1] * a) % b,
F[0] = 1;

Values of a and b are given. My question is whether it is possible to mathematically determine the value of i if you are given F.
 
Mathematics news on Phys.org
Well first of all, we would have to know what that means! In some computer languages "a % b" is used to mean "the integer part of a divided by b". Is that what you mean?

It looks to me like there are going to be some values of n so that F<i>\ne n</i> for any i so if you mean "solve F= n", then in general there is no solution. Assuming that F is, in fact, some value of F, then you could use that recursive relation to keep calculating F[1], F[2], etc. until you finally get the given F.
 
the F must obviously repeat after at most b steps, since there are at most b values F can have.

This is a Linear congruential random number generator, and you can find lots about them.
The general equation for such a generator is F = (F[i-1] * a + c) % b.

If you have c = 0, you get F<i> \equiv F[0] a^i </i> (mod b)

If you want to calculate possible i's for an F, you'll need Eulers theorem:
If a and n are coprime then:

a^{\phi(n)} \equiv 1 (mod n)

\phi(n) is the totient function, the number of positive integers, less than n that are coprime to n.
 
Here is a little puzzle from the book 100 Geometric Games by Pierre Berloquin. The side of a small square is one meter long and the side of a larger square one and a half meters long. One vertex of the large square is at the center of the small square. The side of the large square cuts two sides of the small square into one- third parts and two-thirds parts. What is the area where the squares overlap?

Similar threads

  • · Replies 10 ·
Replies
10
Views
1K
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K