Based on the Wikipedia article, the best I’ve been able to come up with so far is this, which works for 9/11 sizes:
A_SERIES = [
[841, 1189],
[594, 841],
[420, 594],
[297, 420],
[210, 297],
[148, 210],
[105, 148],
[74, 105],
[52, 74],
[37, 52],
[26, 37]]
C_SERIES = [
[917, 1297],
[648, 917],
[458, 648],
[324, 458],
[229, 324],
[162, 229],
[114, 162],
[81, 114],
[57, 81],
[40, 57],
[28, 40]]
def a_to_c(dimension):
return dimension * pow(2, 1.0 / 8)
def main():
for a_values, c_values in zip(A_SERIES, C_SERIES):
a_to_c_values = [
int(round(a_to_c(a_values[0]))),
int(round(a_to_c(a_values[1])))]
if a_to_c_values != c_values:
print str([a_to_c(a_values[0]), a_to_c(a_values[1])]) + ' != ' + str(c_values)
if __name__ == '__main__':
main()
$ ./an-to-cn.py
[161.39514443445813, 229.00662385970412] != [162, 229]
[114.50331192985206, 161.39514443445813] != [114, 162]
[80.69757221722907, 114.50331192985206] != [81, 114]
Edit: Great answers so far, which make it clear that computing the C size based on arbitrary widths and heights (which was the goal of this project) is not possible. I’ll just use the 2^(1/8) factor without rounding to come as close as possible to the idea of the thing. Resulting OpenSCAD code:
outer_width = paper_width * pow(2, 1.0 / 8);
outer_height = paper_height * pow(2, 1.0 / 8);
I really dont know how they come to that formula, but I would say it is just wrong.
There is a reasons how it and why it was developed as it is.
The ratio of A is 1:sqrt(2). So when you half a side you got the next smaller one.
(The beginning has 1 m^2 – thats why it easy to calc the weight when you got the weight in g/m^2).
B is the geometric mean from A and A one size bigger.
And C is the geometric mean from B and A.
So for C you got:
The problem is you can not use the final short formula, as there the rounding of the in between h_A size is lost.
The problem is the h_A * sqrt(2) (h_ for height), as this does NOT give the the size of paper one number higher.
Its the other way around, you divide by sqrt(2) to get the next smaller size.
210 / sqrt(2) = 148,49 which is rounded to 148
but on the other hand 148 * sqrt(2) ist 209,03.
So you have really to compute
So either you need the A size one bigger in addition, or you compute for A the C value one smaller as you can compute the smaller A value from the bigger one.