Skip to content

Latest commit

 

History

History

the-modulo-3-sequence

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Consider a sequence where the first two numbers are 0 and 1 and the next number of the sequence is the sum of the previous 2 modulo 3. Write a function that finds the nth number of the sequence.

Constraints:

  • 1 ≤ N ≤ 10^19

Example:

sequence(1);
0
sequence(2);
1
sequence(3);
1