0
$\begingroup$

Newer Taiwan house numbers cannot end in 4. In order to not have one side of the street grow faster than the other, we must also throw away those ending in e.g., 3.

Is there a algebraic function f(n) that would give

  n   f(n)
-------------
  1   1
  2   2
  3   5
  4   6
  5   7
  6   8
  7   9
  8  10
  9  11
 10  12
 11  15

or is the only way to determine what number we should give a given nth house is to run through the whole list up to n? (perl:)

my $t;
for ( 1 .. $ARGV[0] ) {
    $t += 2 if ++$t % 10 == 3;
}
printf "%3d %3d\n", $_, $t for $ARGV[0];

(Perhaps actually a plot to reserve numbers for invading Martian's pillboxes?!)

One might think this sounds like octal numbers, but alas we are only talking about the final digit here.

$\endgroup$

5 Answers 5

1
$\begingroup$

Perhaps you can use the relationship $h(n+8)=h(n)+10$ where $h(n)$ denotes the house number of the $n$-th house. This then generalizes to $h(n+8k)=h(n)+10k$.

So for example, $h(79)=h(7+8\cdot 9)=h(7)+10\cdot 9=9+90=99$.

$\endgroup$
1
$\begingroup$

My understanding of tetraphobia is that it is wider than the last digit, it is just that the classic photos of elevator panels are typically taken in Taiwanese buildings with less than 30 storeys. For general tetraphobia:

Define $f(n)$ as follows. Write $n$ in base $8$, but treat it as base $10$. Then increase all digits $>2$ by $2$. Eg $11=11_{10}\to13_8\to15_{10}$. Or $121\to171_8\to191$.

If you really want to limit it to the last digit, then we just drop one-fifth of the numbers. But we need a little care. So the basic idea is something like $f(n)=\lceil\frac{5n-2}{4}\rceil$. But that drops 3 and 8, instead of 3 and 4. So you need to increase the last digit by 1 if it is 4,5,6 or 7.

For example, to get the 30th number you take $\frac{5\cdot30-2}{4}=37$, round up to 37, then add 2 to get 39.

$\endgroup$
3
  • $\begingroup$ This would be correct if house numbers could not contain a 3 or a 4 anywhere. However, the problem only says house numbers cannot end in a 3 or a 4. $\endgroup$
    – JimmyK4542
    Jul 6, 2016 at 5:07
  • $\begingroup$ @JimmyK4542 Thanks. Now played it both ways! $\endgroup$
    – almagest
    Jul 6, 2016 at 5:46
  • $\begingroup$ Thanks and indeed it is only the last digit. Google(Chinese) $\endgroup$ Jul 10, 2016 at 9:14
1
$\begingroup$

To get the $n$th house, wouldn't you simply figure $\lfloor n/8\rfloor*10+ (n \mod 8)$ with $n \mod 8$ converted to the proper last digit?

Example, $159$... $159 = 8*19 + 7$. $19*8$ is converted to $190$. And the $7$ is converted to $9$ and so the address is $199$.

Which makes sense: $1- 10$ are the numbers for $1-8$; $2-10$ are the numbers from $9-16$; etc. so $n*10 + 1 - (n+1)*10$ are the numbers $n*8 - (n_1)*8$. And $190- 199$ are the numbers $152-160$.

$\endgroup$
1
$\begingroup$

Define $k^\uparrow:=k\>$ if $k\leq2$, and $k^\uparrow:=k+2$ otherwise. Then $$f(n)=10\cdot\left\lfloor{n\over8}\right\rfloor+(n\ {\rm mod}\ 8)^\uparrow\ .$$

$\endgroup$
2
  • $\begingroup$ Thank you everybody. However upon reading each one of your answers, I have difficulty translating them to Perl to give them a test run. And even if I do, there is something wrong still. $\endgroup$ Jul 10, 2016 at 10:03
  • $\begingroup$ Whatever the merits of the various answers: Their worth is in terms of real mathematics, and has nothing to do with any Perl test runs. $\endgroup$ Jul 10, 2016 at 15:41
-2
$\begingroup$

You should use this function:

$$f(n) = \begin{cases} n + 2 + 2 \lfloor \frac { n - 3} 8 \rfloor, & n \ge 3 \\ n, & 0<n<3 \end{cases} .$$

$\endgroup$
2
  • $\begingroup$ How did you come up with the function $\endgroup$
    – Shailesh
    Jul 11, 2016 at 1:20
  • $\begingroup$ Works great. Perl test: for(1..999){print $_ < 3 ? $_ : $_ + 2 + 2 * int( ( $_ - 3 ) / 8 )}; $\endgroup$ Aug 11, 2016 at 13:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .