Giter VIP home page Giter VIP logo

squared-digits's Introduction

Forks Stargazers Issues MIT License LinkedIn


Squared Digits

PHP assessment and refresher (IEL-SE-1)

Table of Contents
  1. About The Project
  2. Usage
  3. License
  4. Contact
  5. Acknowledgments

About The Project

This is a simple PHP script designed to both refresh my knowledge of PHP in addition to serving as an assessment for potential employers.

It takes all the integers from a specified number down to 1 and checks to see how many of them reduce to 89 using a "squared digits" algorithm.

The "squared digits" algorithm means that the digits of each number are individually squared, then summed together to reach a new number. The algorithms continue this process with each new number derived.

There are two algorithms, each results in a different count at the end.

get_repeating_val

The "get_repeating_val" stays true to the spirit of the assignment in that it returns the first value that repeats during the loop. Although this is more technically correct, it does not lead to the assignment's expected counts at the end, thus the need for the other algorithm,

get_looping_val

The "get_looping_val" algorithm searches for the first instance of "89" or "1" in the loop and (rightfully) assumes that it will eventually loop back to that number again, so it immediately returns that number.

This algorithm eventually leads to the correct counts as defined in the initiall assignment.

(back to top)

Built With

(back to top)

Usage

As this is a simple PHP script, the best way to use it is by running it in your favorite IDE.

(back to top)

License

Distributed under the ISC License. See LICENSE.txt for more information.

(back to top)

Contact

Chris McGee - @SturmB - [email protected]

Project Link: https://github.com/SturmB/squared-digits

(back to top)

squared-digits's People

Contributors

sturmb avatar

Watchers

 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.