The FAST trick to test if n is prime (with Python code) | AKS Primality Testing in poly(log n) time

Поделиться
HTML-код
  • Опубликовано: 18 ноя 2024

Комментарии • 9

  • @MihaiNicaMath
    @MihaiNicaMath  11 месяцев назад +2

    Link to the original Pascal's triangle video ruclips.net/video/HvIh1Ngah0A/видео.html

  • @henryginn7490
    @henryginn7490 11 месяцев назад +3

    Amazing video, I really love the exploratory style! I had always wondered how this could lead to a fast method for prime checking as I thought computing the nth row was still very expensive, it was nice to learn how it could be done. I'm going to start looking up maths papers for things I am curious about after watching this.

    • @MihaiNicaMath
      @MihaiNicaMath  11 месяцев назад +1

      Thanks! Ya prime numbers and stuff is quite far from what I normally do, but when the paper has a nice "idea" section you can totally get into it :)

  • @nobutty999
    @nobutty999 5 месяцев назад +1

    Really interesting video. A lot went over my head but I grasped just enough to appreciate how amazing this algorithm is!

  • @uuujjwalsquare8991
    @uuujjwalsquare8991 5 месяцев назад +1

    Important thing to be noted is this property is known from 1600 .. AKS prime testing indeed use it as initial lemma but but but it have advance modular and polynomial property involve which make it faster

  • @theostienissen7277
    @theostienissen7277 8 месяцев назад +2

    There is a faster way to calculate the n-th row. n choose (k+1) is just n choose k multiplied by (n - k) / (k+1)
    Easy to verify. I wrote the procedure in PL/SQL instead of python, but you should be able to convert.
    Problem is that the code needs to be a bit more advanced for larger numbers, but this is also easy doable.
    create or replace function prime_check (p_integer in integer) return boolean
    is
    l_test integer := p_integer;
    l_mod integer;
    begin
    for k in 2 .. floor (p_integer / 2)
    loop
    l_test := l_test * (p_integer - k + 1) / k;
    l_mod := mod (l_test, p_integer);
    exit when l_mod != 0;
    end loop;
    return l_mod = 0;
    end prime_check;
    /

  • @michael-nef
    @michael-nef 11 месяцев назад +2

    Great follow up & video!

  • @user-nj1og6yb7v
    @user-nj1og6yb7v 11 дней назад

    "Dereliquerunt me lantern aquae vivae."
    "The number 1, joined to infinity, adds nothing to it, no more than one foot to an infinite measure. The finite is annihilated in the presence of the infinite, and becomes a pure nothing. So our spirit before God, so our justice before divine justice. There is not so great a disproportion between our justice and that of God, as between 1 and infinity…." ~Blaise Pascal.