0
$\begingroup$

The following is resubmitted as edit here to reflect suggested formatting corrections so indentations separate the lines neatly. I also fixed the unknown D variable which I actually meant to state as x (there is no D).

So I have an equation, and it works fine with just 1 input for P, as with:

P=11

x=7

(Binomial[Reverse[Range[((P + 1)/2), (P - 3)]], 
  Range[(P - 3) - ((P + 1)/2) + 1]])/x

But when I try using multiple input at once I get an error:

P={11,13}

x=7

(Binomial[Reverse[Range[((P + 1)/2), (P - 3)]], 
  Range[(P - 3) - ((P + 1)/2) + 1]])/x

Thread::tdlen : Objects of unequal length in . . . cannot be combined.

Keep in mind I'm also trying to do this not just for a range of P, but dependent on what P is, also for a range of all natural integers x, where

x ≤ ( P - 4 )

AND

( P - ( x + 2 ) ) ≤ ( ( P - 5 ) / 2 )

The list of primes I'm trying to use for P is given by

Table[Prime[n], {n, Range[5, 7]}]

So that's {11,13,17}.

So far I've been doing this by hand, where I start with the equation with the lowest allotted prime (11) and list out from largest to smallest the range of x possible by restating the equation and altering x, then calculating the list of data individually, which is tedious and also isolates each expression from one another, defeating the purpose here not presented as part of the problem, but possibly relevant to syntax of the solution, since the point was to find matching integer quotient results between any such expressions with the same divisor (its order in the list, which dividends they were found for given the divisor and what the quotient was, so four pieces of data, but you don't need to do that)

How do we get it to return the proper output of generating the sets of all the equations as a set of sets in a single output? I am very confused, but I'll answer any questions anyone may have to point me in the right direction, thanks.

$\endgroup$
  • $\begingroup$ What is D? In any case, let p be the set of p you're after, x be the associated sets of x for each, and f be your function. p = {a, b}; x = {{a1, a2}, {b1}}; Join @@ MapThread[f[#1, #] & /@ #2 &, {p, x}] will give a list with each marshaled together... (a,b, a1... are placeholders for the values in this example) $\endgroup$ – ciao Jun 12 '15 at 23:26
  • $\begingroup$ Thanks for the help, I'm just having trouble implementing it, in part because of the confusion with D, which is actually left over from when I was trying to change it to X. Thus the range for the proper x dividing any given P is given by the equations I corrected above x ≤ ( P - 4 ) AND ( P - ( x + 2 ) ) ≤ ( ( P - 5 ) / 2 ) What exactly does the finished entry look like? I'll toy with it more, I'm probably not formatting it right or something $\endgroup$ – Travis Arlen McCracken Jun 13 '15 at 23:26
  • $\begingroup$ If you'll PM me I'd be open to a conversation later if we're both on at the same time, might be more fluid (I missed you by about 20 hours hah, will stay up tonight to look more carefully $\endgroup$ – Travis Arlen McCracken Jun 13 '15 at 23:29
  • $\begingroup$ @ciao I don't think that worked at all, but maybe I'm being silly somehow. I'll refresh this page often until someone pings a reply and answer any specific questions or explain how this is failing more specifically. Could you show how using a range of primes as P would generate the equations, and then how division by x multiple times given its domain restriction (dependent on P per the two above AND conditions) would result in the set of sets? $\endgroup$ – Travis Arlen McCracken Jun 14 '15 at 4:03
  • $\begingroup$ See if this floats your boat - else perhaps put an explicit example of output expected in your OP: Block[{p = #}, (Binomial[Reverse[Range[((p + 1)/2), (p - 3)]], Range[(p - 3) - ((p + 1)/2) + 1]])/x /. Solve[4 + x <= p && 1 + p <= 2 x, Integers]] & /@ Prime@Range[5, 7] $\endgroup$ – ciao Jun 14 '15 at 5:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.