×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# single line graph puzzle

## single line graph puzzle

(OP)
How can you connect these nine points with a line drawn in a single stroke with only four segments!

#### CODE

.       .       .

.       .       .

.       .       .

Here's an exemple on how it does not work, because the left middle point is not on the graph.

#### CODE

.-------.-------.
\_             !
\_           !
\_         !
.      \.       .
\_     !
\_   !
\_ !
.-------.------\.

Bye, Olaf.
Replies continue below

### RE: single line graph puzzle

#### CODE

_/|
_/  |
_/    |
/      |
.       .       .
\_   _/        |
\_/          |
_/ \_         |
./     \.       .
_/         \_     |
_/             \_   |
_/                 \_ |
/______._______.______\.

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
http://www.silkypups.com

### RE: single line graph puzzle

#### CODE

._______.______.________
!\_                   _/
!  \_               _/
!    \_           _/
.      \.       ./
!        \_   _/
!          \_/
!         _/ \_
.       ./     \.
!     _/
!   _/
! _/
!/

### RE: single line graph puzzle

(OP)
yes, correct. That puzzle seems to be known.

It's a good example of thinking outside of the box.

Bye, Olaf.

### RE: single line graph puzzle

This scales up nicely:

3 x 4 dots with 5 lines
4 x 4 dots with 6 lines
4 x 5 dots with 7 lines
etc.

### RE: single line graph puzzle

BTW, there are at least three distinct solutions (not counting rotations and reflections) for the 4 x 4 with 6 lines.  See if you can find all three.

Side note:  I once had an employee that went to a class where the instructor used the classic 3 x 3 to teach "think outside the box" and unless she heard wrong, the instructor stated that the 4 x 4 square does not have a solution.  Moral -- Don't believe everything that your teachers say:  Check things out for yourself.

### RE: single line graph puzzle

I usually didn't believe anything my teachers said.

<.

### RE: single line graph puzzle

>That puzzle seems to be known.

Yes, since years and years ago ...

But I never saw the others what Zathras has posted.

### RE: single line graph puzzle

(OP)
Zathras said 6 lines. Havent experimentetd much, but perhaps that's without the single line rule, drawing the solution with a single stroke.

Bye, Olaf.

### RE: single line graph puzzle

No, no.  Single line.  Just like the 9-dot version.

3 x 3 = 4 lines
3 x 4 = 5 lines
4 x 4 = 6 lines
4 x 5 = 7 lines

all with the same rules... each dot once and only once, connected lines (i.e., without lifting up the pencil.

Follow-up on the 3 x 3... when presented to young children, it is amazing the creativity they can demonstrate (before the school system burns it out of them).

A couple of examples.  One child noticing that the dots were hand drawn and therefore not exactly on grid coordinates saw that three lines could be used in a Z-shaped pattern with the lines joining at a distance on the right and left of the pattern.

Another, noticing that the dots were drawn on a page of a "flip chart" and that the dots had dimension (again, hand drawn) and the drawing implement was a rather broad-tipped "magic marker" simply folded the paper upwards such that the dots from the second and third rows nearly overlapped the dots on the first and solved the problem with A SINGLE LINE!!!

### RE: single line graph puzzle

3X4  would be like such:

.----.----.    .
\           /|
\       /  |
.    .    .    .
|     \  /     |
|      /\      |
.    .    .    .
|  /        \  |
|/            \|

### RE: single line graph puzzle

Thinking literally outside the square, here's another possibility...

Let the points be named:

A   B   C

D   E   F

G   H   I

Line 1: E to B
Line 2: Circle, from B, through D, H, F and back to B
Line 3: B to C
Line 4: Circle, from C, through A, G, I and back to C

Max Hugen
Australia

### RE: single line graph puzzle

I'm surprised there are no takers on this one.

The problem also extends to 25 dots in a 5x5 square with 8 lines.  (At least 2 distinct solutions. - Easily derived from two of the 4x4 solutions.)

I tried to find answers to the 4x4 with Google, but couldn't find any.  Is it really possible that this is something new under the sun?

### RE: single line graph puzzle

Here, 8 lines, hard to draw.

#### Spoiler:

.   .___.___.___.___
|   |             _/
.___.___.___.___./__
|\__|_       _/  _/
.   .  \._  ./  ./
|   |     \/___/
.   .   ./  ./\_.__
|   | _/  _/       \___
.   ./  ./  .___.______\
|_ /|_ /
/   /

<.

### RE: single line graph puzzle

Sorry monksnake, that doesn't look like a valid solution.

It's hard to see, but it looks like at least one dot is being visited more than once.  For example, the first dot in the second row looks like it is on three different line segments.  See previous post... Each dot must be visited once and only once.  You've got the connected line segments part right, though.

Multiple dot visits:
Row 2 column 1 (visited three times)
Row 2 column 2 (visited twice)
Row 2 column 5 (visited twice)
Row 5 column 2 (visited twice)

I would suggest starting with the 4x4 and then scale up.

### RE: single line graph puzzle

I didn't realize, (based on the other posts) that a dot could only be visited once.

<.

### RE: single line graph puzzle

That's why it's such a tough puzzle.

There are three distinct solutions to the 4x4 and at least 2 to the 5x5.

Two of the 4x4 can scale up to 5x5.

I have not yet found a solution to 6x6.  My hope is to find a solution that scales up to nxn.  Theoretically, if a solution can be found that has an end outside of the graph and doesn't pass thru "virtual" dots outside of the graph, then it would be possible to scale up to infinity with a square spiral.  At least, that's what I'm looking for.

### RE: single line graph puzzle

One 4x4 Solution

#### Spoiler:

1  0  A  B  C  D  0  2

0  0  E  F  G  H  0  0

0  0  I  J  K  L  0  0

0  0  M  N  O  P  0  0

0  0  0  0  0  0  0  0

0  0  3  0  0  0  0  0

N to H (N,K,H)
H to E (G,F,E)
E to 5 (I,M)
3 to 2 (O,L)
2 to 1 (D,B,C,A)
1 to P (J,P)

### RE: single line graph puzzle

4x5 Solution

#### Spoiler:

~_   _
| | | |
| | | |
| | | |
| |_| |

About the same as the 3x4 solution.

### RE: single line graph puzzle

5x5 Solution

#### Spoiler:

. 1     A  B  C  D  E     2
.
.       F  G  H  I  J
.
.       K  L  M  N  O
.
.       P  Q  R  S  T
.
.       U  V  W  X  Y  4
.
.
.
.       3

L to V (L,Q,V)
V to J (R,N,J)
J to F (I,H,G,F)
F to 3 (K,P,U)
3 to 2 (W,S,O)
2 to 1 (E,D,C,B,A)
1 to 4 (M,T)
4 to X (Y,X)
Moving one step further, a 5x6 solutiong would be like 3x4 and 4x5.

### RE: single line graph puzzle

6x6 Solution

#### Spoiler:

.!  A  B  C  D  E  F  @
.
.   G  H  I  J  K  L
.
.   M  N  O  P  Q  R
.
.   S  T  U  V  W  X
.
.   Y  Z  1  2  3  4
.
.   5  6  7  8  9  0  #
.
.   $About the same as the 5x5, but I'm going to run through it backwards to make it easier to find where # and ! should be. X to 8 [X,3,8] 8 to # [9,0] # to ! [4,U] It's probably easiest to figure out where # and ! are if you draw a line through 4 and U. ! to @ [A,B,C,D,E,F] @ to$ [R,W,2,7]
\$ to G [5,Y,S,M,G]
G to L [H,I,J,K,L]
L to 6 [Q,V,1,6]
6 to N [Z,T,N]
N to P [O,P]
It looks like the solution builds off the previous with the last two lines catching a couple of the extra dots.  I have a solution that's about the same, but would add two lines to the begining of this solution.  It's just figuring out which two dots the long diagonal (# to !) hits.  If we make it a battleship grid it'd run through D3 & E6.

If you read the spoiler, I also solved the 7x7 (I'll post the complete solution if someone asks).  I would imagine you can keep building up from this solution to work any n x n grid.

### RE: single line graph puzzle

Skie: Congratulations on finding a fourth way to do the 4x4.  I had not seen that particular one before.  (This is exactly why I posted the puzzle -- I want to find more solutions.)

However, I don't think your 5x5 is correct.  Your line from 1 to 4 which passes thru both T and M also passes thru F which makes a second visit to that point.

The 6x6 is beautiful.  Nice job!

By all means, please post the 7x7

### RE: single line graph puzzle

You're right, my 5x5 would hit "F" twice.  It doesn't with my not evenly spaced dots with not-quite straights lines. :D
5x5 Fixed

#### Spoiler:

In order to avoid the hit at "F" twice.  Erase the line starting at 1 until it's just over the original starting point.  Then move the starting point of L just above it so those 2 lines cross

This should cause it to start at A and end at O

7x7 Solution

#### Spoiler:

0 1 2 3 4 5 6 7 8
A . . . . . . .
B . . . . . . .
C . . . . . . .
D . . . . . . .
E . . . . . . .
F . . . . . . .
G . . . . . . .
H

1: C4 to C2
2: C2 to F2
3: F2 to B6
4: B6 to B1
5: B1 to H1
6: H1 to A8
7: A8 to A0
8: A0 to G8 (Runs through D3 and E6)
9: G8 to G3
10: G3 to D7
11: D7 to F7
12: F7 to F5

### RE: single line graph puzzle

Excellent!  I think your 5x5 is different from either of the two that I found.  That makes at least three distinct ways to do a 5x5, and four distinct ways to do a 4x4.

Nice job on the 7x7.  One typo: Line 10 s/b C7, not D7.

I still don't see any general solution, since all of the ones found so far visit virtual dots outside of the current grid, preventing a simple turn and go algorithm.

### RE: single line graph puzzle

Skie, you deserve a star.

<.

### RE: single line graph puzzle

I don't know if there's an algorithm, but the solutions have a common pattern.  I quickly worked up an two 8x8 solutions, one that's like 7x7 and one that's like 5x5 (fixed) solution.  The only hard part is figuring out where the triangle-joining diagonal is and making sure it doesn't double-dot.

What I wonder is given the multiple solutions for larger girds if it's possible to use less lines.

### RE: single line graph puzzle

I've come up with two more 6x6 solutions.  I haven't been able to find a way to get it down to 9 lines though.  It seems I always end up with two dots that require a diagonal.

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!