Program to print prime number pyramid

I think you've already figured it out by looking at the above pattern that the numbers are all prime numbers. It takes number of lines \((n)\) as input and prints exactly \(n(n+1)/2\) prime numbers. For example, if \(n=4\) then we have \(4(4+1)/2 = 10\) prime numbers in the pattern. Each line in the pattern has prime numbers exactly equal to the line number. For example, line 4 has 4 prime numbers, similarly, line 7 has 7 prime numbers.
\[\therefore 1 + 2 + 3 + 4 +...+(n-1)+ n\\
= n(n+1)/2\\
or, \sum_{i=1}^{n} i = n(n+1)/2\]
This follows the triangular number sequence.

My solution:



  1. Search engine optimization is now the thorn in lots of advertising pros
    aspect. The truth is that businesses who are not
    currently using professional internet marketing services
    to aid them with their own online promotion haven't all incorporated community in promotion and
    their sites, meaning that they're probably being penalized directly now by the search

  2. I'm really impressed with your writing skills aand also with the
    layout on your weblog. Is this a paid theme or did you customize it yourself?

    Eitgher way keep up thee excellent quality writing, it's rare
    to see a great blog like this one today.

  3. Its like you learn my thoughts! You appear to know so much approximately this, such as you wrote the book in it or something.
    I feel that you just could do with a few % to pressure the
    message house a little bit, however instead of that, this is
    excellent blog. A fantastic read. I’ll certainly be back.
    I have been browsing online more than 2 hours today, yet I never found any interesting article like yours.
    It’s pretty worth enough for me. In my opinion, if all webmasters and bloggers made
    good content as you did, the web will be a lot more useful than ever before.

    It is perfect time to make some plans for the long
    run and it’s time to be happy. I have read this publish and if I may just I desire to suggest
    you few attention-grabbing things or tips. Perhaps
    you can write next articles relating to this article.

    I desire to read more issues approximately it!

  4. I am sure this piece of writing has touched all the internet users, its really really
    nice piece of writing on building up new blog. I am sure this piece of
    writing has touched all the internet users, its really
    really good paragraph on building up new webpage.

    Greetings! I've been reading your website for a while now and
    finally got the bravery to go ahead and give you a shout
    out from Porter Tx! Just wanted to tell you keep
    up the fantastic job!

  5. Greetings! I know this is kinda off topic however , I'd figured I'd
    ask. Would you be interested in trading links or maybe guest writing a blog article or vice-versa?
    My website covers a lot of the same subjects as
    yours and I feel we could greatly benefit from each other.
    If you might be interested feel free to shoot me an email.
    I look forward to hearing from you! Fantastic blog by
    the way!

  6. Ahaa, its pleasant discussion regarding this piece of writing here at this web site, I
    have read all that, so at this time me also commenting at this place.
    Hey there just wanted to give you a quick
    heads up. The text in your post seem to be running off the screen in Opera.
    I'm not sure if this is a format issue or something to do
    with browser compatibility but I thought I'd post to
    let you know. The design and style look great though! Hope you get the problem fixed soon. Thanks I've been browsing online greater than three hours as of late,
    yet I never found any fascinating article like yours. It's lovely worth enough for me.
    In my opinion, if all web owners and bloggers made excellent content as you did,
    the net will probably be a lot more helpful than ever before.

  7. I couldn't resist commenting. Very well written!

  8. I visited multiple blogs but the audio quality
    for audio songs existing at this website is really fabulous.


Post a Comment