-2 base

Size
1,641 Kb
Views
10,120

How do I make an -2 base?

What is a -2 base? How do you make a -2 base? This script and codes were developed by Piotr Kozanecki on 15 January 2023, Sunday.

-2 base Previews

-2 base - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>-2 base</title>
</head>
<body> <script src="js/index.js"></script>
</body>
</html>

-2 base - Script Codes JS Codes

function resolve(S) { let result = S.slice(0); S.map(function(element, index, array) { if (index === array.length - 1) { result.push(element); } else { result[index + 1] += element; } }); result.map(function(element, index, array) { if (element > 1) { array[index] %= 2; if (array[index] === 0) { if (typeof array[index + 1] !== 'undefined') { array[index + 1]? array[index + 1] = 0: array[index +1 ] = 1; } else { array.push(1); } } } }); while (result[result.length - 1] === 0) { result.pop(); } return result;
}
function calculateNeg2(array) { let result = 0, base = 1; array.map(function(element, index, array) { result += element * base; base *= -2; }); return result;
}
let a = [1, 0, 0, 1, 1];
console.log(calculateNeg2(a));
console.log(resolve(a));
console.log(calculateNeg2(resolve(a)));
// resolve(a);
-2 base - Script Codes
-2 base - Script Codes
Home Page Home
Developer Piotr Kozanecki
Username kozanecki_p
Uploaded January 15, 2023
Rating 3
Size 1,641 Kb
Views 10,120
Do you need developer help for -2 base?

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!

Piotr Kozanecki (kozanecki_p) Script Codes
Create amazing marketing copy 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!