RUVIDEO
Поделитесь видео 🙏

Euler and Python! Ep 029 - Distinct powers

Hey Nerd boys and girls! Welcome back to our regular programming. In this video we take two distinct approaches to Euler Problem 29: Distinct Powers. Enjoy!

Links:
Project Euler #029: https://projecteuler.net/problem=29
My Github: https://github.com/SquareKnight/onb-math
NOTE: During recording, my audio got borked. What we basically do in the 2nd approach is:
- We state that raising a to power b is the same as repeating a's prime factors b times. Note that 6^2 = (2 * 3)^2 = (2 * 3) * (2 * 3) = 2 * 2 * 3 * 3. We can say that 36 has the same 'prime factor footprint' (PFF) as 6, but with factor 2.
- Given the range of bases 2 - 100, which of these bases are powers themselves? These go on a watchlist. Looking at 36 again, the key to the dict would be 36, the value saved is factor 2 and that 6 was the base number is no longer interesting - but more on that in a minute.
- Looping through all the bases (2 - 100), we decide how many unique powers they would generate. For every number not on the watchlist, this is simply 99 (1 for every b in range 2 - 100). If 'a' is on the watchlist though, it will be less, depending on the factor:
* If base 'a' has the same PFF as some earlier base, then X (=base a ^exp b) will already be in the distinct powers list if it has the same amount of PFF's as Y (lower base ^ highter exp).
* This can be determined by multiplication: raising 36 ^ 2 is basically (2PFF)^2, thus 4 PFF. We already saw 4 PFF with 6 ^ 4.
* Thus, for every exponent b in (2-100) we will generate a list (factor*exponent) PFFs
* For every number with the same PFF but a smaller factor (i.e. for f in range(factor-1)) we make the list (f*exponent), then note any hits with the list for the list above and cross them off.
* The number of unique powers that 'a' would generate is the length of the list left-over.

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Euler and Python! Ep 029 - Distinct powers», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.