# Algebra-filter: when will I get out of jail? (good time credit forumla)

October 31, 2008 10:25 AM Subscribe

Algebra-filter: help me create a formula to calculate "

When my clients are "sentenced" to county jail, I know that they will serve

(((actual days in jail) divided by 4) less any remainder, i.e., rounded down) x 2) + actual days = sentence

or

So if someone is sentenced to 30 days, they serve 20:

(20/4 - remainder) x 2 + 20 =

(5 x 2) + 20 =

10 + 20 =

30

Or as the courts put it:

I want to find out how many

**good time credits**" for California jails: ([{actual days in jail/4} - any remainder] x 2) + actual days in jail = number of days sentenced to jail Solve for "actual" Show your workWhen my clients are "sentenced" to county jail, I know that they will serve

*about*two-thirds of that sentence (i.e., 30 day sentence = 20 "actual" days). But there is a (relatively) complicated formula for determining the "actual days" which is, in fact, finding for the "days sentenced":

(((actual days in jail) divided by 4) less any remainder, i.e., rounded down) x 2) + actual days = sentence

or

**([{A/4} - remainder] x 2) + A = S**

So if someone is sentenced to 30 days, they serve 20:

(20/4 - remainder) x 2 + 20 =

(5 x 2) + 20 =

10 + 20 =

30

Or as the courts put it:

The proper method of calculating presentence custody credits is to divide by four the number of actual presentence days in custody, discounting any remainder. That whole-number quotient is then multiplied by two to arrive at the number of good/work credits. Those credits are then added to the number of actual presentence days spent in custody, to arrive at the total number of presentence custody credits. (People v. Smith (1989) 211 Cal.App.3d 523, 527; People v. Bravo, supra, 219 Cal.App.3d at p. 731.)

The proper method of calculating presentence custody credits is to divide by four the number of actual presentence days in custody, discounting any remainder. That whole-number quotient is then multiplied by two to arrive at the number of good/work credits. Those credits are then added to the number of actual presentence days spent in custody, to arrive at the total number of presentence custody credits. (People v. Smith (1989) 211 Cal.App.3d 523, 527; People v. Bravo, supra, 219 Cal.App.3d at p. 731.)

I want to find out how many

**days someone will actually spend in jail**(actual days) based on

**how many days they are sentenced to**serve (sentence).

I don't understand the question because you already have a formula.

posted by rhizome at 10:58 AM on October 31, 2008

posted by rhizome at 10:58 AM on October 31, 2008

Are you sure that "good time credits" are the same as "presentence custody credits"?

Google tells me that "Good time credits are awarded to inmates who perform exceptional acts: participation in charity runathons, community service projects, donating blood, or assisting staff in emergency situations." In other words, good behaviour while in custody.

while Presentence credits is says are "a provision which [...] permits a sentencing judge to take into account any time spent in custody by the person as a result of the offence" - which for some reason count at a higher rate, as the formula describes. In other words, 20 days in custody awaiting trial/sentencing/etc means 30 days gets knocked off your sentence because of the time you have already spent locked up.

posted by Mike1024 at 11:00 AM on October 31, 2008

Google tells me that "Good time credits are awarded to inmates who perform exceptional acts: participation in charity runathons, community service projects, donating blood, or assisting staff in emergency situations." In other words, good behaviour while in custody.

while Presentence credits is says are "a provision which [...] permits a sentencing judge to take into account any time spent in custody by the person as a result of the offence" - which for some reason count at a higher rate, as the formula describes. In other words, 20 days in custody awaiting trial/sentencing/etc means 30 days gets knocked off your sentence because of the time you have already spent locked up.

posted by Mike1024 at 11:00 AM on October 31, 2008

Lemurrhea came up with the same thing I came up with, but I hesitated to post it. I'm pretty sure there is a way to include A mod 4 in this equation, but it goes beyond my high-school algebra.

I can get this far:

A div 4 - A mod 4 = (S-A)/2

and at that point, I start flailing.

posted by adamrice at 11:10 AM on October 31, 2008

I can get this far:

A div 4 - A mod 4 = (S-A)/2

and at that point, I start flailing.

posted by adamrice at 11:10 AM on October 31, 2008

If you use 2/3S you'll never be off by more than 1.5 days. You'll always be under-estimating the time by 0 to 1.5 days

posted by RustyBrooks at 11:12 AM on October 31, 2008

posted by RustyBrooks at 11:12 AM on October 31, 2008

Actually make that 1.75 days, I think.

posted by RustyBrooks at 11:13 AM on October 31, 2008

posted by RustyBrooks at 11:13 AM on October 31, 2008

If S = sentenced days,

if s mod 4 == 0: a = s - (s / 2) or:: a = s/2

if s mod 4 =/= 0: a = s - (int(s / 4) * 2).

So: If S is divisible by 4, then the actual days served is S/2.

If S isn't, then go to the 'last number' divisible by 4, or in other words the largest number smaller than S divisible by 4, and add the difference between S and the 'last number' to S/2.

So: 88 days sentenced in jail: actual sentence is 88/2, or 44.

90 days sentenced in jail: the largest number divisible by 4 and smaller than 90 is 88, and 90 - 88 = 2, so add 2 to 44: 46.

It's pretty quick. 102 days sentenced? 100 days sentence = 50 days actual, and since there's a 2-day difference between 102 and 100, that means it's a 52 days actual sentence.

posted by suedehead at 11:40 AM on October 31, 2008

if s mod 4 == 0: a = s - (s / 2) or:: a = s/2

if s mod 4 =/= 0: a = s - (int(s / 4) * 2).

So: If S is divisible by 4, then the actual days served is S/2.

If S isn't, then go to the 'last number' divisible by 4, or in other words the largest number smaller than S divisible by 4, and add the difference between S and the 'last number' to S/2.

So: 88 days sentenced in jail: actual sentence is 88/2, or 44.

90 days sentenced in jail: the largest number divisible by 4 and smaller than 90 is 88, and 90 - 88 = 2, so add 2 to 44: 46.

It's pretty quick. 102 days sentenced? 100 days sentence = 50 days actual, and since there's a 2-day difference between 102 and 100, that means it's a 52 days actual sentence.

posted by suedehead at 11:40 AM on October 31, 2008

Due to the facts Lemurrhea presented, you can't have a simple inverse to this function. However, you can have a piecewise linear function that will work for your case. Starting from the estimation of 2S/3, you can correct it based on the periodic nature of the function.

if (S mod 6 is 0, 1 or 2), A <- floor(2S/3)

if (S mod 6 is 3 or 4), A <- floor(2S/3) + 1

if (S mod 6 is 5), A <- floor(2S/3) - 1

posted by demiurge at 11:56 AM on October 31, 2008

if (S mod 6 is 0, 1 or 2), A <- floor(2S/3)

if (S mod 6 is 3 or 4), A <- floor(2S/3) + 1

if (S mod 6 is 5), A <- floor(2S/3) - 1

posted by demiurge at 11:56 AM on October 31, 2008

Actually, lemurrhea's last set of equations doesn't seem quite right:

21 is floor(21/4) * 2 + 20 = floor(5.25) * 2 +

22 is floor(22/4) * 2 + 20 = floor(5.50) * 2 +

23 is floor(23/4) * 2 + 20 = floor(5.75) * 2 +

In fact, lemurrhea's relation between A and S is exactly right: A = (2/3) * S + (1/3) * n, where n is the remainder of A divided by four.

Note that there are some values for S which cannot be obtained from any value of A. For example, if A = 7, then S is 9 but if A = 8, then S is 12. This implies that S can never be 10 or 11. I'm not sure what this means in the context of the question, but I think the OP may be able to shed a little more light on

posted by mhum at 12:44 PM on October 31, 2008

21 is floor(21/4) * 2 + 20 = floor(5.25) * 2 +

**21**= 5 * 2 +**21**= 3122 is floor(22/4) * 2 + 20 = floor(5.50) * 2 +

**22**= 5 * 2 +**22**= 3223 is floor(23/4) * 2 + 20 = floor(5.75) * 2 +

**23**= 5 * 2 +**23**= 33In fact, lemurrhea's relation between A and S is exactly right: A = (2/3) * S + (1/3) * n, where n is the remainder of A divided by four.

Note that there are some values for S which cannot be obtained from any value of A. For example, if A = 7, then S is 9 but if A = 8, then S is 12. This implies that S can never be 10 or 11. I'm not sure what this means in the context of the question, but I think the OP may be able to shed a little more light on

*exactly*what A and S represent.posted by mhum at 12:44 PM on October 31, 2008

mhum, I will thank you not to make me look like a goddamn idiot.

posted by Lemurrhea at 12:56 PM on October 31, 2008

posted by Lemurrhea at 12:56 PM on October 31, 2008

Oh whoops, disregard my answer earlier -- I confused A and S.

posted by suedehead at 12:59 PM on October 31, 2008

posted by suedehead at 12:59 PM on October 31, 2008

**Okay, this one works for sure:**

(int(A / 4) * 2) + A = S.

So:

if A % 4 == 0: or 1.5 A = s, or A = S * 2/3.

if A % 4 != 0: (int(A / 4) * 2) + A = S.

So: If S is divisible by 3, then the actual days served is 2/3 of S.

If S isn't, then go to the 'last number' divisible by 3, or in other words the largest number smaller than S divisible by 3, and add the difference between S and the 'last number' to 2/3 * S.

So: 66 days sentenced in jail: actual sentence is 2/3 * 66, or 44.

67 days sentenced in jail: the largest number divisible by 3 and smaller than 67 is 66, and 67 is 1 larger than 66, so add 1 to 44: you get 45.

It's pretty quick. 183 days sentenced? 180 days sentence = 120 days actual, and since there's a 3-day difference between 183 and 180, that means it's a 123-day actual sentence.

posted by suedehead at 1:13 PM on October 31, 2008

Nevermind, my last example was wrong. I hereby apologize for spamming this thread and will retreat having made no positive contribution whatsoever! *retreats*

posted by suedehead at 1:19 PM on October 31, 2008

posted by suedehead at 1:19 PM on October 31, 2008

I reduced the formula down as far as (a - a mod 4)/2 +a = s but honestly I don't think it can be solved because you have 2 unknowns (a and a mod 4) unless someone else knows a way to solve mod without trial and error.

I think the best you can hope for is to do s*2/3 +/-1 and plug all the numbers into the formula til you get the right answer.

posted by missmagenta at 2:23 PM on October 31, 2008

I think the best you can hope for is to do s*2/3 +/-1 and plug all the numbers into the formula til you get the right answer.

posted by missmagenta at 2:23 PM on October 31, 2008

Some close answers here, but this should do it:

A = floor(2S/3)

If S is not divisible by 6, add 1.

posted by sen at 4:53 PM on October 31, 2008

A = floor(2S/3)

If S is not divisible by 6, add 1.

posted by sen at 4:53 PM on October 31, 2008

Ok, this should do the trick

a = floor(2s/3) + ceil((s%6)/6)

posted by missmagenta at 3:32 AM on November 1, 2008

a = floor(2s/3) + ceil((s%6)/6)

posted by missmagenta at 3:32 AM on November 1, 2008

I think all of these answers are missing something.

The pre-sentence custody calculation only applies when they've spent time in jail before their finding of guilt(or technically, their sentencing). They may have been denied bail or been unable to post bail, etc. If your client was never in jail, then a sentence of 30 days will be a full 30 days, starting from the sentencing. (Subject to any parole)

posted by newatom at 12:46 PM on November 1, 2008

The pre-sentence custody calculation only applies when they've spent time in jail before their finding of guilt(or technically, their sentencing). They may have been denied bail or been unable to post bail, etc. If your client was never in jail, then a sentence of 30 days will be a full 30 days, starting from the sentencing. (Subject to any parole)

posted by newatom at 12:46 PM on November 1, 2008

Wow, great answers. Sorry I wasn't hear to provide comments - I was interrupted mid-question by a serious family medical emergency that is on-going so I'll be brief:

(1) Seems that it comes down to what

If this were not the case, the courts would have already elaborated on a formulation allowing us to calculate A (actual days served on "good time") based on S (the days sentenced). This is the answer to WHY the equation is not solvable for S.

(2) The basic equation that

As for the remaining answers, some are excellent and some were misguided as a result of my poor question formation. For future reference, this is only referring to misdemeanors in California where good time is actually earned (basically by doing what the guards say and not causing trouble while in county jail). This is distinct from the more complex legislative and judicial programs and schemes for prison or county jail time served prior to a prison sentence, or relating to parole (which, again, is a condition related to service of a prison term, rather than county jail time).

posted by unclezeb at 10:15 AM on November 3, 2008

(1) Seems that it comes down to what

**missmagneta**said:*I don't think it can be solved because you have 2 unknowns (a and a mod 4) unless someone else knows a way to solve mod without trial and error.*If this were not the case, the courts would have already elaborated on a formulation allowing us to calculate A (actual days served on "good time") based on S (the days sentenced). This is the answer to WHY the equation is not solvable for S.

(2) The basic equation that

**Sen**indicated is very close to my approach to estimation when trying to explain (and calculate) for clients how long it will probably be until they are allowed out:**Thanks for helping my conceptualize why this works, I'll pass it on to my colleagues.**

Essentially, two-thirds of the sentence plus a day or two depending.*A = floor(2S/3)*

If S is not divisible by 6, add 1.If S is not divisible by 6, add 1.

Essentially, two-thirds of the sentence plus a day or two depending.

As for the remaining answers, some are excellent and some were misguided as a result of my poor question formation. For future reference, this is only referring to misdemeanors in California where good time is actually earned (basically by doing what the guards say and not causing trouble while in county jail). This is distinct from the more complex legislative and judicial programs and schemes for prison or county jail time served prior to a prison sentence, or relating to parole (which, again, is a condition related to service of a prison term, rather than county jail time).

**Thanks for all the help mefi-maticians!**posted by unclezeb at 10:15 AM on November 3, 2008

This thread is closed to new comments.

[floor(a/4) * 2 ] + a = s

[floor(a/4) * 2 ] = s - a

floor(a/4) = (s - a) / 2 = s/2 - a/2

a = [ 4 * ( s/2 - a/2) ] + n, where n = 0, 1, 2, or 3

a = 2s - 2a + n, where n..

3a = 2s + n, where...

a = (2s + n)/3 = 2s/3 + n/3

since n < 3, n/3 = 0 or 1. We can't determine how that will go, since the floor function loses information. In your original scenario, assume someone actually serves 20, 21, 22, or 23 days.

Watch:

20 is shown in your own work.

21 is floor(21/4) * 2 + 20 = floor(5.25) * 2 + 20 = 5 * 2 + 20 = 30

22 is floor(22/4) * 2 + 20 = floor(5.5) * 2 + 20 = 5 * 2 + 20 = 30

23 is floor(23/4) * 2 + 20 = floor(5.75) * 2 + 20 = 5 * 2 + 20 = 30

posted by Lemurrhea at 10:57 AM on October 31, 2008