Finding i Given F[i] for a Given Equation

  • Context: Undergrad 
  • Thread starter Thread starter ged25
  • Start date Start date
Click For Summary
SUMMARY

The discussion centers on the mathematical determination of the index i given the equation F[i] = (F[i-1] * a) % b, with F[0] = 1. It concludes that while specific values of F[i] may not yield a solution for all i, the recursive relation can be used to compute subsequent values until F[i] is reached. The equation represents a Linear Congruential Generator (LCG), and if c = 0, it simplifies to F[i] ≡ F[0] * a^i (mod b). Euler's theorem is essential for calculating possible indices i when F[i] is known.

PREREQUISITES
  • Understanding of modular arithmetic and congruences
  • Familiarity with Linear Congruential Generators (LCGs)
  • Knowledge of Euler's theorem and the totient function
  • Basic programming skills to implement recursive functions
NEXT STEPS
  • Study Linear Congruential Generators and their applications in random number generation
  • Learn about Euler's theorem and how to compute the totient function
  • Implement a recursive function to calculate F[i] in a programming language of choice
  • Explore the implications of modular arithmetic in cryptography and computer science
USEFUL FOR

Mathematicians, computer scientists, and software developers interested in random number generation, modular arithmetic, and algorithm optimization.

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.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 19 ·
Replies
19
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 77 ·
3
Replies
77
Views
8K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K