Powers of 11 Pattern in Python

Beginner
⏱️ 5 min read
📚 Updated: Aug 2025
🎯 2 Code Examples
Multiplication

What You’ll Learn

How to print the powers of 11 pattern in Python: 1, 11, 121, 1331, 14641. These are \(11^0\) to \(11^4\).

This is a neat pattern because (for small powers) the digits resemble Pascal’s triangle rows.

⭐ Pattern Output

For n = 5 lines, the output looks like this:

Output
1
11
121
1331
14641
1

Complete Python Program

Start with 1, then multiply by 11 on each step to generate the next line.

Python
res = 1

for _ in range(5):
    print(res)
    res *= 11

🧠 How It Works

1

Start with 1

res = 1 represents \(11^0\).

Init
2

Print current value

Each iteration prints the current power of 11.

Output
3

Multiply by 11

res *= 11 moves from \(11^k\) to \(11^{k+1}\).

Update
4

Repeat for n lines

Run the loop n times to print n powers.

Loop
=

Powers of 11

This prints one line per iteration, so it’s linear in the number of lines.

2

Variation — User Input Version

Let the user choose how many lines to print, and generate each line as 11**power.

Python
n = int(input("Enter number of lines: "))
if n < 1:
    raise ValueError("n must be at least 1")

for power in range(n):
    print(11 ** power)

💡 Tips for Enhancement

Try These

  • Print more lines and observe where carrying starts (e.g., \(11^5 = 161051\))
  • Generate Pascal’s triangle directly and compare digits
  • Format large values using underscores ({value:_}) for readability
  • Use big integers confidently—Python handles them automatically
  • Try base-10 vs base-11 representations as an extension

Avoid

  • Assuming the Pascal’s triangle digit trick works for all powers (carrying breaks it)
  • Accepting invalid input without handling n < 1
  • Using floating-point exponentiation (pow(11, p) as float) for large p
  • Printing huge powers without thinking about output size

Key Takeaways

1

The lines are powers of 11: \(11^0\) to \(11^{n-1}\).

2

You can generate iteratively (*= 11) or using exponentiation (11**p).

3

For small powers, digits resemble Pascal’s triangle (before carrying).

4

The loop prints one value per line, so it’s O(n) lines.

❓ Frequently Asked Questions

Yes, for small rows: \(11^n\) digits match binomial coefficients without carry. After a few rows, carrying changes the digits.
Multiplication is simple and efficient for sequential powers. Exponentiation is straightforward and clear for each line.
Because the binomial coefficients now require carrying in base 10, so the digits no longer directly match Pascal’s triangle.
It prints n lines, so it’s linear in the number of lines. Computation cost increases with digits for large powers.

Explore More Python Number Patterns!

Mix math ideas with loop practice to discover more interesting numeric patterns.

All Number Patterns →
Did you know?

Binomial coefficients from Pascal’s triangle appear in \((a+b)^n\). Setting \(a=10\) and \(b=1\) gives \(11^n\), which is why this pattern is related.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

7 people found this page helpful