Problem 47345. Find Logic 20
Guess the Logic!
logic(1) = 7
logic(2) = 4
logic(3) = 8
logic(4) = 3
logic(5) = 9
logic(6) = 2
Make a function logic(x) which will return 'x' th term of sequence
Solution Stats
Problem Comments
- 
		1 Comment
 
		ROBERTO
    	on 17 Oct 2025 at 22:54
	
	
  	int logic(int x)
{
   return (int)mod(x,2) ? 7+(x-1)/2 : 4-(x-2)/2; 
}
// I FEEL BETTER NOW (thank you comment..)
Solution Comments
Show commentsProblem Recent Solvers343
Suggested Problems
- 
         
Find the sum of all the numbers of the input vector
52635 Solvers
 - 
         
Celsius to Fahrenheit converter
647 Solvers
 - 
         
         
627 Solvers
 - 
         
         
16867 Solvers
 - 
         
String Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values
1852 Solvers
 
More from this Author40
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!