Giter Site home page Giter Site logo

project-euler's Introduction

project-euler

A mathsy journey through Project Euler!

I avoid brute forcing or iterating as much as I can, prefering closed formulas or a mathematical interpretation when possible.

P1: closed formula using the Principle of Inclusion and Exclusion (PIE)
P2: instead of iterating over the Fibonacci numbers, I only generate the even ones
P6: closed formulas for square of sum and sum of squares
P9: Euclid's formula is used to look for a Pythagorean triplet
P15: combinatorial interpretation of the classic "walk the grid" problem
P28: instead of iterating over the spiral, I exploit the fact that one diagonal is the square of odd numbers and rings have even side length
P31: instead of using a classic recursion scheme, I implement the ring of polynomials and use a generating function
P85: combinatorial interpretation of the classic "rectangles in a rectangle" and some basic algebra to reduce the search space

project-euler's People

Contributors

sphaso avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.