Tips_of_js using JS to realize the search and realization of narcissus number Fibonacci sequence

Source: Internet
Author: User

First, the number of daffodils

1, what is the number of daffodils?

Narcissus number refers to an n-bit positive integer (n≥3), and its number on each bit of the sum of n is equal to its own. (Example: 1^3 + 5^3+ 3^3 = 153)

2, the use of JS to achieve the number of daffodils to find.

This time we look for the number of daffodils method, is the very basic JS in the while loop. The code is as follows:

Si not si very magical ~

Second, Fibonacci sequence

1. What is the Fibonacci sequence?

Fibonacci series (Fibonacci sequence), also known as the Golden Section series, because the mathematician Leonardo's Fibonacci (Leonardoda Fibonacci) to the rabbit breeding as an example of the introduction, so called "Rabbit series", refers to such a series: 1, 1, 2, 3, 5, 8, 13, 21, 、......

2, the use of JS to achieve the Rabbit series of the top 20 list.

This is still done using the while loop, the code is as follows:

Hum, still very magical.

Tips_of_js using JS to realize the search and realization of narcissus number Fibonacci sequence

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.