Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: List manipulation question - 2013
Replies: 5   Last Post: Feb 1, 2013 1:15 AM

 Messages: [ Previous | Next ]
 Bob Hanlon Posts: 906 Registered: 10/29/11
Re: List manipulation question - 2013
Posted: Jan 30, 2013 10:05 PM

list1 = Table[24 + (15*n1), {n1, 2000}];

Take[Select[list1/24, IntegerQ], 9]

{6, 11, 16, 21, 26, 31, 36, 41, 46}

Take[Select[list1, IntegerQ[#/24] &], 9]

{144, 264, 384, 504, 624, 744, 864, 984, 1104}

Apparently you want list2 to consist of the members of list1 that are
integer multiples of 24 rather than the integers in list1/24.

list2 = Select[list1, IntegerQ[#/24] &];

list3 = n2 /. Solve[
{12 + (3*n2) == #, Element[n2, Integers]},
n2][[1]] & /@ list2;

Length[list2] == Length[list3]

True

Bob Hanlon

Consequently, there is an integer n2 for every element of list2.

On Wed, Jan 30, 2013 at 4:26 AM, Lea Rebanks <lrebanks@gmail.com> wrote:
>
> Dear All,
>
> I have the follow problem with the combination of a few lists.
> I shall outline the problem or what I am trying to do.
> I know that to solve this problem requires a number of processes, but I am
> not sure how to setup the coding to achieve my desired result.
> Please could someone show me the coding for this problem.
>
> The problem:-
> 1 - I have a list1 created from 24+(15*n1) All n1 are integers
> 1,2,3,4.....to a large number of integers.
> 2 - I want to divide the list1 by 24 and create another list2 with only the
> integer results in list2.
> Table[24 + 15*i, {i, 100}]/24 ... so that integer results in list2
> = { 144, 264, 384, 504, 624, 744, 864, 984, 1104 }
> 3 - I have another list3 created from 12+(3*n2) All n2 are integers
> 1,2,3,4.....to a large number of integers.
> 4 - With list3 I want to find :-
> (i) The integer number of n2 that either equates 12+(3*n2) = 144 or
> the next FIRST available number in list2 that meets this equality.
> then also (ii)The integer number(s) of n2 that equates 12+(3*n2) = 24+(15*n1) after the first equal value for say 6 repetitions.
> then also (iii)The integer number(s) of n1 that equates 12+(3*n2) =
> 24+(15*n1) after the first equal value for say 6 repetitions.
>
> The above example is quite simple, but I am hoping to setup the coding to
> work with other integer values instead of 3 & 15 which will present more of
> a challenge.
>
> Any help or advice greatly appreciated.
> Best regards,
> Lea...
>
>

Date Subject Author
1/30/13 Chris Arthur
1/30/13 Bob Hanlon
1/31/13 Lea Rebanks
1/31/13 Bob Hanlon
2/1/13 Lea Rebanks