6 kyu

Math challenge #3 [Medium]

Description:

Let f(n)=0nxxx  dxf(n) = \int_0^n\,\lfloor x\rfloor\:x\:\lceil x\rceil\; dx

where x\lfloor x\rfloor denotes the greatest integer smaller than or equal to x (floor function),
and x\lceil x\rceil denotes the smallest integer greater than or equal to x. (ceiling function)

Examples:

⌊6.7⌋ = 6
⌈4.3⌉ = 5

Task

Given a positive integer n, return the value of f(n) mod 1000000007.

1 <= n <= 10^5


Credit: I saw this interesting question on a Prime Newtons video.

His channel is here: https://www.youtube.com/@PrimeNewtons


Also, please check out the rest of the katas in this series! https://www.codewars.com/collections/math-challenges-1

appreciate any feedback given, thank you!

Mathematics

Similar Kata:

More By Author:

Check out these other kata created by goldenratio161

Stats:

CreatedOct 23, 2024
PublishedOct 23, 2024
Warriors Trained256
Total Skips4
Total Code Submissions393
Total Times Completed83
Python Completions70
JavaScript Completions21
Total Stars2
% of votes with a positive feedback rating82% of 19
Total "Very Satisfied" Votes14
Total "Somewhat Satisfied" Votes3
Total "Not Satisfied" Votes2
Total Rank Assessments11
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • goldenratio161 Avatar
  • dfhwze Avatar
Ad