This question has kind of motivated me to try and write something worthwhile. I am making some progress but am not quite there. Still I think I have enough to give an idea where I'm heading

I have posted the output to where im at currently, as getting namespaces and actually trying to figure out how the data types are going to go is well, some fun

More than just solving the OP logic problem, the intention is perhaps more to write something that can be used as support for educational purposes. It is understandable that much of this has already been implemented in many math modules already. However, I maybe just entertaining my own sentiments, but there is something refreshing about getting down to the atomic structure of numbers. And just simply seeing the arithmetic in action. And any excuse to use Perl, for which I think this purpose is suited, is a good excuse.

Hopefully I'll get the logic side of the OP shortly. Fifty quid on it. I did however figure out that I may not have supposed to have been getting negative denominators when row reducing. I guess thats what happens when you take the inverse of a negative fraction by turning it upside down. :p

This looks like a problem that could be dealt with using prime factorisation. But, to get a prime factorisation you need to check the possible combinations of a sum.

tentatively, problem restated: Given a number A, and a List B consisting of one or more numbers, which numbers from B:

When all numbers in B satisfy (some or all?) of these conditions, supply the multiplicities of the numbers required for firstly the summations up to the divisors of both A and B, and secondly any reaminders of numbers that are not divisors but are used in the summation composition.

note: restatement subject to re-interpretation using more appropriate terminology where required. That is, I may mean factor where I have stated divisor. I may mean composite summation. Also to be clarified - where remainders that are not divisors are used in the summation.

Before moving on to a List of multiple numbers, understanding how the failing case works is probably key. With A being 3 and a B being a List or Set from 2.

where B contains only 1 item, B could be construed as a List or a Set. Right now, I am (attempting to be) keeping it simple as an argument list.

Plan of action, is to match A with B. A is a number, B is a List. done. Ok, Let us use b to mean the number in the List.

Plan of action, is to match A with b. Failure is a result of either

This case also highlights another aspect in that b itself is smaller than A, and its first multiple (2b) is larger than A. These conditions in relation to each other should form the basis of an appropriate algorithm for the problem if not solve it.

No errrors found.

getting there, I can now 'split' rather, substitute and count the substitutions, so to say, and test for a remainder, which is half the problem.

output as it stands

TOP my @vn; my $m; for my $n ( 2, 3, 5, 7, 15, 43 ){ $m = num_to_nat($n); push @vn, get_mark_from_nat($m) ; }; print join "\t", @vn; print "\n", # print map { join( ' ', $_, '(' . wildmark_to_num($_) . ')' ) } @vn; #print "\n"; my @hexvn; # ______ @hexvn = map [ $_, sprintf( "%0x", length($_) ), 'my todo hex()', tran +sform_to_hex($_), "\n" ], @vn; print map { my $arr = $_ ; join "\t", map{ join ' ', $_ } @$arr } @he +xvn; print "\n"; OUTPUT || ||| ||||| ||||||| ||||||||||||||| |||||||||||||||||||||| +||||||||||||||||||||| testing prim nat: || split_pat: (?^u:(\|\|)) splitted: 1 x || h remainder: prim nat was || prim nat now testing prim nat: ||| split_pat: (?^u:(\|\|)) splitted: 1 x || h remainder: | prim nat was ||| prim nat now | testing prim nat: ||||| split_pat: (?^u:(\|\|)) splitted: 2 x || h remainder: | prim nat was ||||| prim nat now | testing prim nat: ||||||| split_pat: (?^u:(\|\|)) splitted: 3 x || h remainder: | prim nat was ||||||| prim nat now | testing prim nat: ||||||||||||||| split_pat: (?^u:(\|\|)) splitted: 7 x || h remainder: | prim nat was ||||||||||||||| prim nat now | testing prim nat: ||||||||||||||||||||||||||||||||||||||||||| split_pat: (?^u:(\|\|)) splitted: 21 x || h remainder: | prim nat was ||||||||||||||||||||||||||||||||||||||||||| prim nat now | || 2 my todo hex() 1 x || remainder: ||| 3 my todo hex() 1 x || remainder: | ||||| 5 my todo hex() 2 x || remainder: | ||||||| 7 my todo hex() 3 x || remainder: | ||||||||||||||| f my todo hex() 7 x || remainder: | ||||||||||||||||||||||||||||||||||||||||||| 2b my todo hex() + 21 x || remainder: | Press any key to continue . . .

progress report Re: check possible combination of sum using given array. out by 5168!


not 'A^2 + A^2' ne 'C'

In reply to Re: check possible combination of sum using given array by Don Coyote
in thread check possible combination of sum using given array by dideod.yang

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.