Sign in

Generators

Learn how to generate dummy text with Python!

In this article we’ll be taking a look and generating “Lorem ipsum” dummy text with Python. Most of you have probably encountered dummy text before: all kinds of documents used it. If you have ever used a Google Docs template before, you have definitely seen this kind of text.

What is Lorem Ipsum?


News

How you can contribute to our publication!

Welcome to the Art of Python! As a starting publication that is growing, we are actively looking for writers and bloggers who have a passion for the programming language known as Python.

Content

  • Tutorials on Python 3 highlighting one of your discoveries, achievements, or something you know
  • Have an idea you think is amazing? Share it with the world!
  • Have challenging or elegant Python programming problems and solutions to share? Did you just spend a night working on a bit of code? Write about it!
  • News about new Python 3 libraries and tools for developers
  • We accept both free and paywall

Number Theory

Learn how to write programs involving the Collatz Sequence!

Welcome back! In today’s article, we’ll be taking a look at the Collatz sequence. This article aims to explain the basic principles of the Collatz sequence and how to solve tasks involving it using Python programming.

What is the Collatz Sequence?

The Collatz Sequence is an actively studied sequence, particularly because of its relationship to the Collatz conjecture. Let’s first explain what the Collatz conjecture is, before diving into the specifics about the sequence.

The Collatz Conjecture

This particular conjecture has not been disproved or proved yet, so it remains a mathematical mystery in the world. The conjecture says the following:

The Collatz sequence will always eventually reach…


Number Theory

Learn how to write programs involving the Fibonacci Sequence!

The Fibonacci Sequence shows up and presents itself in quite a lot of ways in mathematics and computer science/programming. This article aims to describe several ways you might see Fibonacci show up, and how to use Python to discover various aspects of the sequence.

What is the Fibonacci Sequence?

The Fibonacci Sequence is a sequence of natural numbers, starting with 1 . It goes like this:

1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, ....

Do you see the pattern? The nth Fibonacci number is the sum of the n-1st and the n-2nd Fibonacci number.

This is…


Number Theory

Learn how to use the Pollard’s Rho Algorithm!

In the first part of this two-article series on prime factorization, I talked about using the simple method of the Sieve of Eratosthenes to factor a number. At the end of that article, I hinted on a much more efficient (but more complicated as well) method: Pollard’s Rho Algorithm.

In case you haven’t read Part 1, you can access it here:

The Approach: Pollard’s Rho

Last time, we talked about using the Sieve of Eratosthenes to find a list of primes, then use that list of primes to factor a number. …


Number Theory

Learn how to write a Python program to prime factorize a number!

There are lots of approaches to prime factorization, but which one is the best? I know best is a subjective term, but when I say best, I say the program that balances efficiency and less code.

The Approach

Let’s first talk about how we will approach solving this problem. The most straightforward way is to use Python to generate a list of primes, then test the number against each of the primes in that list.

However, if we simply create a bunch of loops, the process will take a long time. We will need the make use of a mathematical algorithm.

Most…

Lin Jiang

I am a computer and programming enthusiast, learning anything and everything I can get my hands on!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store