How to disabled ADD TO CART button when user had not checked the zipcode

Consider any convergent series. Lets say that $$a_1 + a_2 + a_3 + \cdots = a$$ where $a_n, a \in \mathbb{R}$ and $a \neq 0$ (Thanks, @anon).

Define $b_n = \dfrac37\dfrac{a_n}{a}$, then the series $b_1 + b_2 + b_3 + \cdots$ converges to $\dfrac37$.


Find the smallest $n$ such that $7|(10^n-1)$. In particular say $10^n-1=7m$. Then write

$$\begin{array}{c l} \frac{3}{7} & =\frac{3m}{7m} \\[2pt] & =\frac{3m}{10^n-1} \\[2pt] & = 3m\frac{1}{10^n}\frac{1}{1-1/10^n} \\[2pt] & =\frac{3m}{10^n}+\frac{3m}{10^{2n}}+\frac{3m}{10^{3m}}+\cdots. \end{array}$$

Since $3m<7m+1=10^n$, this gives an easy way to write out the repeating decimal expansion of the fraction $3/7$. In particular, $10^6-1=7\cdot142857$, and $3\cdot142857=428571$ so $3/7=0.\overline{428571}$.

This can be employed more generally. Without much loss of generality assume $0<a<b$ with $b$ divisible by neither $2$ nor $5$ and find an $n$ such that $b|(10^n-1)$, in particular $10^n-1=bm$, so that

$$\frac{a}{b}=\frac{am}{10^n}+\frac{am}{10^{2n}}+\frac{am}{10^{3m}}+\cdots.$$

Note again $am<bm+1=10^n$ so this provides a clean decimal expansion. We ignore integers, and for rationals more generally we can decompose them into a sum of the nearest integer plus the rational's fractional part, and apply this method to the fractional part, then recombine. For rationals with $2,5$'s in the denominator's prime factorization, pull them out and multiply by them afterwards: their reciprocals are simply $0.5$ and $0.2$ after all.

Finally, for base $r$ (assuming $r$ is a positive natural number anyway), find $n$ such that $b|(r^n-1)$ and adapt this method. (Remember to pull out $\gcd(b,r)$ from the denominator.) Note that $n$ is guaranteed to exist because $r$ has an order modulo $b'$ ($b'$ coprime) by elementary number theory.

Also, if $d|r$, then $\frac{1}{d}=\frac{(r/d)}{r}$ is an easy way to compute the base-$r$ expansion of $1/d$. This helps with the "pulled-out" factors (i.e. with $d=\gcd(b,r)$).


Using the formula for the sum of a geometric series, we get $$ \sum_{k=1}^\infty\frac{3}{8^k}=\frac38\sum_{k=0}^\infty\frac{1}{8^k}=\frac38\frac{1}{1-\frac18}=\frac38\frac87=\frac37 $$ Therefore, $$ \frac37=\sum_{k=1}^\infty\frac{3}{8^k} $$