Project Euler Problem 17

Developer
Size
2,739 Kb
Views
18,216

How do I make an project euler problem 17?

WIP.. What is a project euler problem 17? How do you make a project euler problem 17? This script and codes were developed by Bryan Fillmer on 11 December 2022, Sunday.

Project Euler Problem 17 Previews

Project Euler Problem 17 - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Project Euler Problem 17</title> <script src="https://s.codepen.io/assets/libs/modernizr.js" type="text/javascript"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel='stylesheet prefetch' href='http://maxcdn.bootstrapcdn.com/bootswatch/3.2.0/superhero/bootstrap.min.css'> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ body { padding: 2em;
}
div { max-width: 33em; margin: 0 auto;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <div ng-app="EulerApp" ng-controller="Problem17 as problem"> <h3>Project Euler Problem 17</h3> <ul class="list-unstyled"> <li>0 through 99: {{problem.nums}}</li> </ul>
</div> <script src='http://ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Project Euler Problem 17 - Script Codes CSS Codes

body { padding: 2em;
}
div { max-width: 33em; margin: 0 auto;
}

Project Euler Problem 17 - Script Codes JS Codes

(function () { angular.module('EulerApp', [ ]) .controller('Problem17', function () { /** * Thoughts: * After the first one-hundred you will have a consistent pattern * of the same length per number + the 'hundred' range you are in: * 'one' = 3 + [same length of any other within that 100 block]. * Determine length of first 100, then add the length of each * hundred range name * 100. */ var base = { 0: 'zero', 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine', 10: 'ten', 11: 'eleven', 12: 'twelve', 13: 'thirteen', 14: 'fourteen', 15: 'fifteen', 16: 'sixteen', 17: 'seventeen', 18: 'eighteen', 19: 'nineteen', }; var tens = { 0: '', 1: '', 2: 'twenty', 3: 'thirty', 4: 'forty', 5: 'fifty', 6: 'sixty', 7: 'seventy', 8: 'eighty', 9: 'ninety', }; var hundred = 'hundred'; var and = 'and'; var processTens = function (n) { var tensVal = tens[n.toString().charAt(0)]; return tensVal.length; }; var processNum = function (n) { var tensVal = 0; var onesVal = 0; if (n.toString().length >= 2) tensVal = processTens(n); if (n.toString().charAt(1) <= 1 ) onesVal = base[n].length; return tensVal + onesVal; }; var generateNums = function () { var theNums = 0; for (var n = 0; n <= 20; n++) { theNums += processNum(n); } return theNums; }; this.nums = generateNums(); });
})();
Project Euler Problem 17 - Script Codes
Project Euler Problem 17 - Script Codes
Home Page Home
Developer Bryan Fillmer
Username bfillmer
Uploaded December 11, 2022
Rating 3
Size 2,739 Kb
Views 18,216
Do you need developer help for Project Euler Problem 17?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Bryan Fillmer (bfillmer) Script Codes
Create amazing web content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!