Supply a value and an optional maximum group size.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
At 10:17 AM -0400 4/22/10, Dan Joseph wrote:
On Thu, Apr 22, 2010 at 10:12 AM, Stephen wrote:
1,252,398 DIV 30 = 41,746 groups of 30.
1,252,398 MOD 30 = 18 items in last group
Well, the only problem with going that route, is the one group is not
equally sized to the others. 18 is ok for
On 23 April 2010 13:33, Dotan Cohen wrote:
> What is wrong with 626,299 groups of 2 items each (done in my head, so
> I might be off a little)?
2, 3, 6, 7, 14 and 21 are all valid.
--
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchang
On 22 April 2010 17:07, Dan Joseph wrote:
> Howdy,
>
> This is a math question, but I'm doing the code in PHP, and have expunged
> all resources... hoping someone can guide me here. Â For some reason, I can't
> figure this out.
>
> I want to take a group of items, and divide them into equal groups
On 22 April 2010 17:47, Developer Team wrote:
> Awesome source.
> Thanks
>
> On 4/22/10, Richard Quadling wrote:
>> On 22 April 2010 14:48, Dan Joseph wrote:
>>> On Thu, Apr 22, 2010 at 10:29 AM, Richard Quadling
>>> >>> wrote:
>>>
 >
> It sounds like you are looking for factors.
On Thu, Apr 22, 2010 at 12:16 PM, Richard Quadling wrote:
> On 22 April 2010 14:48, Dan Joseph wrote:
> This seems to be working ...
>
> function findBestFactors($Value, $GroupSize, array &$Factors = null)
>{
>$Factors = array();
>foreach(range(1, ceil(sqrt($Value))) as
On 22 April 2010 14:48, Dan Joseph wrote:
> On Thu, Apr 22, 2010 at 10:29 AM, Richard Quadling > wrote:
>
>> Â >
>> > It sounds like you are looking for factors.
>> >
>> >
>> http://www.algebra.com/algebra/homework/divisibility/factor-any-number-1.solver
>> >
>> > Solution by Find factors of any n
On Thu, 22 Apr 2010 10:49:11 -0400
Peter van der Does wrote:
>
> My take on it:
>
> $Items=1252398;
> $MaxInGroup=30;
> for ($x=$MaxInGroup; $x>1;$x--) {
> $remainder=$Items % $x;
> // Change 17 to the max amount allowed in the last group
> if ($remainder == 0 || $remainder >
On Thu, 22 Apr 2010 10:17:10 -0400
Dan Joseph wrote:
> On Thu, Apr 22, 2010 at 10:12 AM, Stephen
> wrote:
>
> > 1,252,398 DIV 30 = 41,746 groups of 30.
> >
> > 1,252,398 MOD 30 = 18 items in last group
> >
> Well, the only problem with going that route, is the one group is not
> equally sized t
On Thu, Apr 22, 2010 at 10:29 AM, Richard Quadling wrote:
> >
> > It sounds like you are looking for factors.
> >
> >
> http://www.algebra.com/algebra/homework/divisibility/factor-any-number-1.solver
> >
> > Solution by Find factors of any number
> >
> > 1252398 is NOT a prime number: 1252398 =
-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
Sent: 22 April 2010 15:13
To: Dan Joseph
Cc: PHP eMail List
Subject: Re: [PHP] Math Question
On Thu, 2010-04-22 at 10:17 -0400, Dan Joseph wrote:
> On Thu, Apr 22, 2010 at 10:12 AM, Stephen wr
On 22 April 2010 15:26, Richard Quadling wrote:
> On 22 April 2010 15:13, Ashley Sheridan wrote:
>> On Thu, 2010-04-22 at 10:17 -0400, Dan Joseph wrote:
>>
>>> On Thu, Apr 22, 2010 at 10:12 AM, Stephen wrote:
>>>
>>> > 1,252,398 DIV 30 = 41,746 groups of 30.
>>> >
>>> > 1,252,398 MOD 30 = 18 ite
On 22 April 2010 15:13, Ashley Sheridan wrote:
> On Thu, 2010-04-22 at 10:17 -0400, Dan Joseph wrote:
>
>> On Thu, Apr 22, 2010 at 10:12 AM, Stephen wrote:
>>
>> > 1,252,398 DIV 30 = 41,746 groups of 30.
>> >
>> > 1,252,398 MOD 30 = 18 items in last group
>> >
>> Well, the only problem with going
On Thu, 2010-04-22 at 10:17 -0400, Dan Joseph wrote:
> On Thu, Apr 22, 2010 at 10:12 AM, Stephen wrote:
>
> > 1,252,398 DIV 30 = 41,746 groups of 30.
> >
> > 1,252,398 MOD 30 = 18 items in last group
> >
> Well, the only problem with going that route, is the one group is not
> equally sized to t
On Thu, Apr 22, 2010 at 10:12 AM, Stephen wrote:
> 1,252,398 DIV 30 = 41,746 groups of 30.
>
> 1,252,398 MOD 30 = 18 items in last group
>
Well, the only problem with going that route, is the one group is not
equally sized to the others. 18 is ok for a group in this instance, but if
it was a rem
Dan Joseph wrote:
I want to take a group of items, and divide them into equal groups based on
a max per group. Example.
1,252,398 -- divide into equal groups with only 30 items per group max.
1,252,398 DIV 30 = 41,746 groups of 30.
1,252,398 MOD 30 = 18 items in last group
Stephen
--
Jeremy Schroeder wrote:
Hey group
Is there a function that when you divide 2 numbers you drop the
remainder and are left with the whole number.
A whole section of the manual dedicated to mathematical functions!
http://us4.php.net/manual/en/ref.math.php
floor()
ceil()
round()
--
By-Tor.com
It'
Thanks for all the help, floor() was the correct choice for this problem .
-Blake
Vincent Jansen wrote:
Hi Richard
I agree
But you always want to round down ;)
Blake> Is there a function that when you divide 2 numbers you drop the
Blake> remainder and are left with the whole number.
Still
Seems to me you need
floor($number1 / $number2)
Vincent
-Original Message-
From: Richard Davey [mailto:[EMAIL PROTECTED]
Sent: woensdag 11 februari 2004 15:07
To: Jeremy Schroeder
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Math Question
Hello Jeremy,
Wednesday, February 11, 2004, 2
Hello Jeremy,
Wednesday, February 11, 2004, 2:00:32 PM, you wrote:
JS> Is there a function that when you divide 2 numbers you drop the
JS> remainder and are left with the whole number.
round($number1 / $number2)
See the manual for the precision value if you need it.
--
Best regards,
Richard
kowski" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, December 11, 2003 5:22 PM
Subject: RE: [PHP] Re: PHP Math Question
| I do not know if I understand well, but what about
|
| $group=$number % 4;
| if ($group==0) $group=4;
|
| Brona
|
| > -Original Message-
"Mike D" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I'm am completely stumped on a seemingly simple math formula
I need to find a way to map a set of numbers up to 4 (e.g. 1,2,3,4 or 1,2)
to any number in a range of up to 10,000 (ideally, unlimited). Such that,
(e.g. 1,2,3,4)
t;\n";
}
print $i." is to ".$j."\n";
} // end for
?>
Jim
- Original Message -
From: "Bronislav Klučka" <[EMAIL PROTECTED]>
To: "Eric Bolikowski" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, December 11, 200
I do not know if I understand well, but what about
$group=$number % 4;
if ($group==0) $group=4;
Brona
> -Original Message-
> From: Eric Bolikowski [mailto:[EMAIL PROTECTED]
> Sent: Thursday, December 11, 2003 10:53 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: PH
"Mike D" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> I'm am completely stumped on a seemingly simple math formula
>
> I need to find a way to map a set of numbers up to 4 (e.g. 1,2,3,4 or 1,2)
> to any number in a range of up to 10,000 (ideally, unlimited). Such that,
>
> (e.g. 1
If u don't want to use the pi() function.
Try M_PI. This is a pi constant its value is 3.14159265358979323846
$theta=15*M_PI/360;
- Original Message -
From: Anon Y Mous <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, June 23, 2001 2:21 PM
Subject: Re: [P
Have you defined the 'pi' constant?
If you are trying to use PHP's built-in PI constant, it is named 'M_PI'
Perhaps consider increasing your error reporting level so that PHP reports
problems like undefined constants - see error_reporting() for more details.
--zak
- Original Message -
pi is a function. Try this:
$theta = 15*pi()/360;
It should return 0.13089969389957
-Evan Nemerson
> $theta = 15*pi/360;
> gives a value of 0 for $theta... it should be something like 0.131...
> Julia
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTE
""Julia A. Case"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> $theta = 15*pi/360;
> gives a value of 0 for $theta... it should be something like 0.131...
>
> Julia
I get
echo 15 * M_PI / 360;
returns
0.13089969389957
--
PHP General Mailing Li
29 matches
Mail list logo