Problem 52467. Easy Sequences 2: Trigonometric function with integral input and output
The function 'F', defined as:
will always return an integer if the input is a natural number (in radians). Furthermore, since the cosine and sine of 0, are 1 and 0 respectively, therefore F(0) = 0. For a given natural number 'n' your task is to find the value of F(n).
Solution Stats
Problem Comments
-
3 Comments
Mark Posen
on 10 Dec 2021
Can someone please explain test case 4? I don't see what is going on, as intmax-4 is clearly not 1234567891011.
I could only pass this case by bodging x inside the function, which is clearly unsatisfactory.
Dyuman Joshi
on 10 Dec 2021
intmax - 4 is not equal to 1234567891011. But
F(intmax-4) is equal to F(1234567891011). The given function can have same output for different inputs.
Ramon Villamangca
on 14 Dec 2021
Hi Mark,
Trigonometric functions are naturally periodic. So we can expect same function return from different inputs.
Solution Comments
Show commentsGroup

Easy Sequences Volume I
- 10 Problems
- 8 Finishers
- Easy Sequences 1: Find the index of an element
- Easy Sequences 2: Trigonometric function with integral input and output
- Easy Sequences 3: Prime 44-number Squares
- Easy Sequences 4: Eliminate the Days of Confusion
- Easy Sequences 5: Project Euler Problem 1 - Again!
- Easy Sequences 6: Coefficient sums of derivatives
- Easy Sequences 9: Faithful Pairs
- Easy Sequences 10: Sum of Cumsums of Fibonacci Sequence
- Easy Sequences 11: Factorial Digits without Trailing Zeros
- Easy Sequences 12: 50th Prime
Problem Recent Solvers37
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!