Retired

Hyperoperation (retired)

Description:

The most basic operation in mathematics is counting.

1, 2, 3... b + 1 // b # of increments

The next operation is addition.

a + b = a + 1 + ... + 1 // b # of ones

The next extension to this sequence is multiplication

a * b = a + a + ... + a // b # of times

We can extend multiplication to exponentiation

a ^ b = a * a * ... * a // b # of times

This sequence of operations is known as hyperoperation and forms an infinite sequence of potential operations.

Create a function, hyperoperate(a, b , n), that returns the nth operation of a and b.

n = 0 is counting.
n = 1 is addition.
n = 2 is multiplication.
n = 3 is exponentiation.

The function should be able to handle all the cases where b = 0.

Algorithms
Mathematics
Logic
Numbers
Loops
Control Flow
Basic Language Features
Fundamentals
Memoization
Design Patterns
Design Principles

More By Author:

Check out these other kata created by GeorgeSeeger

Stats:

CreatedAug 3, 2016
Warriors Trained30
Total Skips1
Total Code Submissions59
Total Times Completed20
JavaScript Completions20
Total Stars0
% of votes with a positive feedback rating46% of 12
Total "Very Satisfied" Votes4
Total "Somewhat Satisfied" Votes3
Total "Not Satisfied" Votes5
Total Rank Assessments13
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • GeorgeSeeger Avatar
  • cliffstamp Avatar
Ad