/ ProjectEuler Public

My Project Euler solutions

# jlam55555/ProjectEuler

Switch branches/tags
Nothing to show

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

## Files

Failed to load latest commit information.

# ProjectEuler

My Project Euler solutions

#### Motivations

Although Project Euler clearly states that it would rather not have mathematicians share its answers:

Please do not deprive others of going through the same process [of solving the question] by publishing your solution outside of Project Euler.

I have decided to publish mine. These are published only in an educational light, and in a less convenient way to get the answer than some other math blogs, so I deem it alright. Please do not simply copy these answers; if you wish to view the source codes, use it solely for enlightenment on my solutions.

#### Anatomy of a Solution Page

The template that I am using for each solution HTML file is as follows. It includes a stylesheet and sufficient scripts. Here is an example: project euler question 65.

```<!DOCTYPE html>
<html>
<script src="res/bignumber.min.js"></script>
<script src="res/XBigFraction.js"></script>
<script id="script">// javascript
var t1 = performance.now();
BigNumber.config({EXPONENTIAL_AT:500});
for(var i = Math.floor(100/3), e = new XBigFraction(0, 1); i > 0; e = new XBigFraction(1,1).divide(new XBigFraction(1,1).add(new XBigFraction(1,1).divide(new XBigFraction(2*i, 1).add(new XBigFraction(1,1).divide(new XBigFraction(1,1).add(e)).reduce())).reduce())).reduce(), i--);
for(var i = 0, sum = 0, numerator = e.add(new XBigFraction(2, 1)).numerator.toString().split(""); i < numerator.length; sum += parseInt(numerator[i]), i++);
var t2 = performance.now();
</script>
~Finds the numerator of the (simplified) 100th convergent of <code><em>e</em></code> (using the formula <code><em>e</em> = [2; 1,2,1, 1,4,1, 1,6,1 , ... , 1,2k,1, ...]</code>)~
#Uses my new library <a href="res/XBigFraction.js">XBigFraction.js</a>. It can handle large fractions (needs to include <a href="res/bignumber.min.js">bignumber.min.js</a> first, however). I also made a simpler version at <a href="res/XFraction.js">XFraction.js</a>.#
<script src="res/euler.js"></script>
</body>
</html>```
• `<body onload="links('Convergents of e', '65', 'sum')">` Title, ID, answer
• `<script src="{SCRIPT_SRC}"></script>` Dependencies
• `<script id="script"> ... </script>` Main script to run
• `// javascript` Language of script (as of now, only JS)
• `~Finds the numerator ... ~` Description
• `#Uses my new ... #` Note (can have multiple)
• `<script src="res/euler.js"></script>` Formatting script

Where's the head? Where are the styles?

The `<head>`, including styles, are automatically generated by the `euler.js` script.

#### Other Notes

• I include my library, `xmath.js`, on many of these questions.
• When files are given by Project Euler in its questions to analyze or parse, I often used a modified form, either placed directly in the HTML file or in a separate file that is retrieved using an AJAX GET request (performed with a synchronous jQuery `\$.get()` function). Usually, it is formatted to be a (valid) JSON file.

My Project Euler solutions

## Releases

No releases published

## Packages 0

No packages published