Teaser 3088: Bog standard deviation
From The Sunday Times, 28th November 2021 [link] [link]
My four toilet rolls had zigzag-cut remnants (not unlike that shown). Curiously, each polygonal remnant had a different two-figure prime number of sides, each with a digit sum itself prime.
Calculating the average number of sides for the four remnants and the average of their squares, I found that the average of the squares minus the square of the average had a value whose square root (the “standard deviation”) was a whole number.
I also noticed that a regular convex polygon with a number of sides equal to the average number of sides would have an odd whole-number internal angle (in degrees).
Give the “standard deviation”.
[teaser3088]

Jim Randell 2:45 pm on 26 November 2021 Permalink |
A bit of a convoluted scenario, but the calculations are fairly straightforward.
The average number of sides must be an integer to construct the polygon, and so the average of the squares must also be an integer, and so must the internal angle. So we can keep everything in the integers.
This Python program runs in 46ms.
Run: [ @replit ]
from enigma import Primes, dsum, subsets, div, sq, is_square, printf primes = Primes(100) # candidate primes ps = list(p for p in primes.irange(10, 99) if dsum(p) in primes) # choose 4 of them for ns in subsets(ps, size=4): # calculate the mean, and mean square m = div(sum(ns), 4) m2 = div(sum(sq(n) for n in ns), 4) if m is None or m2 is None: continue # standard deviation sd = is_square(m2 - sq(m)) if sd is None: continue # internal angle a = div(360, m) if a is None or a % 2 == 0: continue # output solution printf("{ns}; m={m} m2={m2} sd={sd} a={a}", a=180 - a)Solution: The “standard deviation” is 15.
The prime numbers are: 23, 29, 47, 61.
Which give a mean of 40, and a mean square of 1825. And a regular 40-sided polygon has internal angles of 171°.
Without the regular polygon condition there are three potential integer solutions:
A 42-gon and 50-gon don’t have whole number internal angles, so the requirement for the angle to be odd isn’t necessary (although it may help in a manual solution).
LikeLike
Frits 5:44 pm on 26 November 2021 Permalink |
Starting from the (odd, even) divisor pairs of number 360.
from enigma import divisor_pairs, dsum, is_square P = {3, 5, 7} P |= {2} | {x for x in range(11, 100, 2) if all(x % p for p in P)} # candidate primes P = sorted(p for p in P if p > 9 and dsum(p) in P) # get_standard_deviation by decomposing number <t> into <k> increasing # numbers from <ns> so that sum(<k> numbers) equals <t> def get_standard_deviation(t, k, ns, sq_avg, s=[]): if k == 1: if t in ns and t > s[-1]: # average of the squares minus the square of the average is square sd = is_square(sum(x**2 for x in s + [t]) // 4 - sq_avg) if sd is not None: yield sd else: for n in ns: if s and n <= s[-1]: continue yield from get_standard_deviation(t - n, k - 1, ns, sq_avg, s + [n]) min_avg = sum(P[:4]) / 4 max_avg = sum(P[-4:]) / 4 penmax_avg = sum([P[-5]] + P[-3:]) / 4 # penultimate maximum # determine number of sides for all possible angles lst_nsides = [nsides for a, nsides in divisor_pairs(360) if a % 2 and min_avg <= nsides <= max_avg] # skip smallest angle if number of sides is too close to max_avg if penmax_avg < lst_nsides[0] < max_avg: lst_nsides = lst_nsides[1:] # solve for all possible angles for avg in lst_nsides: for sd in get_standard_deviation(4 * avg, 4, P, avg**2): print("answer:", sd)LikeLike