Greatest Integer Function Problem

  • Thread starter Thread starter Lobdell
  • Start date Start date
  • Tags Tags
    Function Integer
Click For Summary
The discussion revolves around creating a formula for a phone company's billing structure based on the greatest integer function. The problem highlights the need to account for both integer and non-integer minute usage, specifically addressing how to charge for partial minutes. A suggestion is made to use the floor function to manage rounding down, while also considering a method to round up for billing purposes. The proposed solution involves using a combination of the ceiling function and costs associated with the first and additional minutes. This approach aims to accurately calculate charges regardless of whether the talk time is a whole number or not.
Lobdell
Messages
4
Reaction score
0
I just need a push in the right direction for this one.
The problem is: A phone company charges this amount for the first minute and that amount for each additional minute. If someone talks for 3.1 minutes, they are charged for 4 minutes. Make a formula, blah blah blah...
Anyway I'm having trouble with making the equation work for both of these situations: when x is an integer, and when x is not an integer.
I already thought about int(x-.1) but then x could be .01, and it wouldn't be correct.

Any help is appreciated.
 
Mathematics news on Phys.org
You're trying to make a "round up" function. Since you're allowed to use the floor ("round down") function, consider this:

int(x)=-int(-x), x is an integer
int(x)=1-int(-x), otherwise
 
All you need is a + b ceil(x-1), where a is the cost for the first minute and b is the cost of each additional minute.
 
Here is a little puzzle from the book 100 Geometric Games by Pierre Berloquin. The side of a small square is one meter long and the side of a larger square one and a half meters long. One vertex of the large square is at the center of the small square. The side of the large square cuts two sides of the small square into one- third parts and two-thirds parts. What is the area where the squares overlap?

Similar threads

Replies
7
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
9
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K