Multiply-by-11 Series Pattern in JavaScript

What You’ll Learn
How to print the number pattern 1, 11, 121, 1331, 14641 in JavaScript.
Each line is generated by multiplying the previous value by 11, which is a simple and memorable loop exercise.
⭐ Pattern Output
For lines = 5, the pattern looks like this:
1
11
121
1331
14641Complete JavaScript Program
We start with 1, print it, then multiply by 11 for the next line. This version uses BigInt so it scales safely if you increase the line count.
const lines = 5;
let value = 1n;
for (let i = 1; i <= lines; i++) {
console.log(String(value));
value *= 11n;
}🧠 How It Works
Set the number of lines
lines = 5 controls how many values to print.
Start from 1
value = 1n is the first printed line.
Print the current value
We convert BigInt to string: String(value), then print it.
Multiply by 11 for the next line
value *= 11n; transforms 1 into 11, then 121, then 1331…
Simple multiply-by-11 pattern
One loop, one multiplication rule, clean output.
Variation — Browser (document.write) Version
Print the same values directly in an HTML page using document.write:
<!DOCTYPE html>
<html>
<body>
<script>
var lines = 5;
var value = 1n;
for (var i = 1; i <= lines; i++) {
document.write(String(value));
document.write("<br>");
value = value * 11n;
}
</script>
</body>
</html>💡 Tips for Enhancement
Try These
- Increase
linesto print more values (BigInt helps prevent overflow) - Compare the output with Pascal’s triangle for the first few rows
- Use arrays to store the sequence for later use in your program
- Format values with commas for readability if you print many lines
Avoid
- Expecting the pattern to match Pascal’s triangle for large lines (carries appear)
- Using Number for huge values if you increase lines a lot (precision loss)
- Mixing BigInt with Number in arithmetic without converting types
Key Takeaways
The sequence is generated by repeatedly multiplying by 11.
For a few lines, values resemble Pascal’s triangle rows.
BigInt helps you scale without losing precision.
This is an O(n) pattern: one loop, one print per line.
❓ Frequently Asked Questions
n when logged directly.value *= 11. BigInt is recommended when values get large.Explore More JavaScript Number Patterns!
Next, try building Pascal’s triangle directly, then compare it with powers of 11 to see where the carry starts.
The identity “powers of 11 resemble Pascal’s triangle” is a fun math trick for small rows, but it breaks once coefficients exceed 9 and carrying begins.
12 people found this page helpful
