My Math Forum  

Go Back   My Math Forum > High School Math Forum > Algebra

Algebra Pre-Algebra and Basic Algebra Math Forum


Reply
 
LinkBack Thread Tools Display Modes
February 26th, 2008, 07:13 AM   #1
Newbie
 
Joined: Feb 2008

Posts: 1
Thanks: 0

Function problem

I have to write a function f(n) that has the result the lowest number higher or equal to n that is dividable by 4.
For ex:

f(24) = 24, f(25)=28 ...

The only solution that I can think of is:

f(n) = [n/4+1]*4.

But it doesnt work for n numbers that are dividable by 4.

Thank you and sorry if I've made some mistake, I'm new here!
spank is offline  
 
February 26th, 2008, 10:47 AM   #2
Global Moderator
 
CRGreathouse's Avatar
 
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 938

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Re: Function problem

Terminology: you need to find an expression for that function. The words already define the function.

Quote:
Originally Posted by spank
I have to write a function f(n) that has the result the lowest number higher or equal to n that is dividable by 4.
4[n/4] gives you the next lower one, so I think -4[-n/4] should do what you want. Check it and tweak if it's off.
CRGreathouse is offline  
February 27th, 2008, 11:52 AM   #3
Global Moderator
 
Joined: Dec 2006

Posts: 19,703
Thanks: 1804

If n is a non-negative integer, f(n) = 4[(n + 3)/4], where [x] denotes the integer part of x.
skipjack is offline  
Reply

  My Math Forum > High School Math Forum > Algebra

Tags
function, problem



Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Function problem mathwiztheo Algebra 2 November 19th, 2012 02:58 AM
lg function problem nanalala125 Linear Algebra 1 September 19th, 2012 07:00 PM
Function problem reave Algebra 1 November 4th, 2011 05:05 AM
1 Word problem and 1 function problem, PLEASE HELP ME murkr Algebra 1 April 19th, 2010 04:56 PM
What's the function for the problem? jsucupira Algebra 2 October 15th, 2007 11:59 AM





Copyright © 2018 My Math Forum. All rights reserved.