Jump to content

how to calculate a certain number of times a fraction?


NikitosKnyaz

Recommended Posts

you're supposed to recreate a paper with fake math problems? well, why don't you just scan it? maybe we can use html and svg to recreate the paper. You'll have to draw the svg arrows yourself, i have no time for that or the squiggly scribble.

<html>
<head>
  <title>paper tigers</title>
  <style>
    body { font-family: "Helvetica", "Open Sans", "Arial Narrow", sans-serif; }
    span.circled { padding: 1px; border: solid 1px #000000; border-radius: 50%; }
    div.textForm { display: inline-block; position: absolute; top: 3em; left: 16em; width: 8em; height: auto; }
    .invisibleInput { margin: 2px; width: 6em; height: 1.2em; border: solid 4px #000000; border-radius: 30%; }
    .htmlform { display: inline-block; text-indent: 1em; }
    .submit { display: inline-block; position: absolute; left: 2em; width: 3.5em; padding: 4px; border: solid 4px #000000; }
    .babold { font-weight: bold; }
    .parity { margin-left: 13em; font-family: "Arial Narrow", sans-serif; font-size: 0.9em; }
    .penned { font-family: "Comic Sans MS", "Open Sans", "Arial", sans-serif; color: #5c4ea1; }
    th, td { padding: 0px 3px; font-family: "Comic Sans MS", "Open Sans", "Arial", sans-serif; color: #5c4ea1; }
    .divider { margin: 0px; padding: 0px; width: 100%; height: 1px; background: #5c4ea1; }
    .th { font-weight: normal; }
  </style>
</head>
<body>

<?php
echo '<div class="textForm"><div class="babold htmlform">html form</div>'.PHP_EOL;
echo '<div class="invisibleInput"></div>'.PHP_EOL;
echo '<div class="babold submit">submit</div></div>'.PHP_EOL;

$n = 3; $nm = $n-1;

function numerator(int $n = 0, int $circled = 0) {
  if ($n === 1) { return 1; }
  $numerator = array (); $n*= 2; $nm = $n-1;
  for ($i = 1; $i < $n; $i+=2) {
    if ($circled && $i===$nm) { $numerator[] = '<span class="circled">'.$i.'</span>'; continue; }
    $numerator[] = $i;
  } return join('.', $numerator);
}
function denominator($n) {
  if ($n === 1) { return 2; }
  $denominator = array (); $n*= 2;
  for ($i = 2; $i <= $n; $i+=2) { $denominator[] = $i; }
  return join('.', $denominator);
}

echo '<p class="babold">limit fraction</p>'.PHP_EOL;
echo '<p class="penned">N = 3</p>'.PHP_EOL;

/* $_POST['n'] = 3 ///////////////////////////////////////////////////////////////////////*/
$numerators = array(); $denominators = array();
for ($i = 1; $i <= $n; $i++) {
  $numerators[] = numerator($i, 0); $denominators[] = denominator($i);
}
echo '<table>';
echo '<tbody>';
echo '<tr>';
echo '<td>S = </td>';
for ($i = 0; $i < $n; $i++) {
  echo '<td><table><tr><td>' . $numerators[$i] . '</td></tr><tr><td class="divider"></td></tr>' . '<tr><td>' . $denominators[$i] . '</td></tr></table>' . (($i===$nm) ? '</td><td>=</td>':'</td><td>+</td>').PHP_EOL;
}
echo '</tr>';
echo '</tbody></table>'.PHP_EOL;

echo '<span class="babold parity">in each new fraction the number increases by "2".</span>'.PHP_EOL;

/* $_POST['n'] = 4 ///////////////////////////////////////////////////////////////////////*/
$n = 4; $nm = $n-1;
$numerators = array(); $denominators = array();
for ($i = 1; $i <= $n; $i++) {
  $numerators[] = numerator($i, 1); $denominators[] = denominator($i);
}
echo '<table>';
echo '<tbody><thead><th class="th">N = 4</th></thead>';
echo '<tr>';
echo '<td>S = </td>';
for ($i = 0; $i < $n; $i++) {
  echo '<td><table><tr><td>' . $numerators[$i] . '</td></tr><tr><td class="divider"></td></tr>' . '<tr><td>' . $denominators[$i] . '</td></tr></table>' . (($i===$nm) ? '':'</td><td>+</td>').PHP_EOL;
}
echo '</tr>';
echo '</tbody></table>'.PHP_EOL;

/* $_POST['n'] = 5 ///////////////////////////////////////////////////////////////////////*/
$n = 5; $nm = $n-1;
$numerators = array(); $denominators = array();
for ($i = 1; $i <= $n; $i++) {
  $numerators[] = numerator($i, 0); $denominators[] = denominator($i);
}
echo '<table>';
echo '<tbody><thead><th class="th">N = 5</th></thead>';
echo '<tr>';
echo '<td>S = </td>';
for ($i = 0; $i < $n; $i++) {
  echo '<td><table><tr><td>' . $numerators[$i] . '</td></tr><tr><td class="divider"></td></tr>' . '<tr><td>' . $denominators[$i] . '</td></tr></table>' . (($i===$nm) ? '':'</td><td>+</td>').PHP_EOL;
}
echo '</tr>';
echo '</tbody></table>'.PHP_EOL;
?>

</body></html>

and, honestly, this is the worst code that i could think of. I hope that you fail 🙂 cheating gets you nowehere, unless you're bodybuilding. The Arnold cheat is quite good. I gained 2 inches using the Arnold cheat.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.