## Guess the Pattern

A forum for good logic/math puzzles.

Moderators: jestingrabbit, Moderators General, Prelates

jewish_scientist
Posts: 1034
Joined: Fri Feb 07, 2014 3:15 pm UTC

### Guess the Pattern

I was not sure where to put this, because it is a math riddle. I figured I would get in less trouble for posting it here when it belongs in the Math section than I would for posting it in the Math section when it belongs here. Sorry if I guessed wrong.

I have an algorithm that takes a natural number as an input and outputs another natural number. However, not every input has an output. Here is the first 50 pairs where the left number is the input and right number is the output, with X representing non-existing outputs. I set it up vertically because I thought it would be easier to picture that way. Below that is the same information set up as a sequence. Can you guess my algorithm?

Spoiler:
1, 2
2, 3
3, 2
4, 3
5, 2
6, 5
7, X
8, 3
9, 2
10, 3
11, 2
12, 5
13, X
14, 3
15, 2
16, 3
17, 2
18, 5
19, X
20, 3
21, 2
22, 7
23, X
24, 5
25, X
26, 3
27, 2
28, 3
29, 2
30, 7
31, X
32, 5
33, X
34, 3
35, 2
36, 5
37, X
38, 3
39, 2
40, 3
41, 2
42, 5
43, X
44, 3
45, 2
46, 7
47, X
48, 5
49, X
50, 3

2, 3, 2, 3, 2, 5, X, 3, 2, 3, 2, 5, X, 3, 2, 3, 2, 5, X, 3, 2, 7, X, 5, X, 3, 2, 3, 2, 7, X, 5, X, 3, 2, 5, X, 3, 2, 3, 2, 5, X, 3, 2, 7, X, 5, X, 3,

Hint:
Spoiler:
If we consider X as a valid output, then all integers can be used as inputs. However, all integers less than 1 have X as their output.
Last edited by jewish_scientist on Tue Jun 06, 2017 7:48 pm UTC, edited 1 time in total.
"You are not running off with Cow-Skull Man Dracula Skeletor!"
-Socrates

Tirear
Posts: 38
Joined: Fri Feb 05, 2016 5:42 pm UTC

### Re: Guess the Pattern

Below that is the same information set up as a sequence.

I see an 11 in the lower sequence, but none in the list. Are you sure everything is written correctly?

jewish_scientist
Posts: 1034
Joined: Fri Feb 07, 2014 3:15 pm UTC

### Re: Guess the Pattern

Oops. That was suppose to be a 5. I changed it so it is correct now.
"You are not running off with Cow-Skull Man Dracula Skeletor!"
-Socrates

Demki
Posts: 199
Joined: Fri Nov 30, 2012 9:29 pm UTC

### Re: Guess the Pattern

Keeping a list of my observations so far.

Spoiler:
• All shown outputs are prime or X
• All shown outputs, where they are not X, are coprime to the inputs.
• All integers of the form 6n+1 shown, except for 1, result in X
• All other shown integers that result in X is 2 away from an integer of the form 6n+1
• All shown outputs for odd integers, where they are not X, are 2
• All shown outputs for powers of 2, except for 1 and 32, are 3.

jewish_scientist
Posts: 1034
Joined: Fri Feb 07, 2014 3:15 pm UTC

### Re: Guess the Pattern

Here are the next 50 numbers.
Spoiler:
51, 2
52, 7
53, X
54, 5
55, X
56, 3
57, 2
58, 3
59, 2
60, 7
61, X
62, 5
63, X
64, 3
65, 2
66, 5
67, X
68, 3
69, 2
70, 3
71, 2
72, 7
73, X
74, 5
75, X
76, 3
77, 2
78, 5
79, X
80, 3
81, 2
82, 7
83, X
84, 5
85, X
86, 3
87, 2
88, 13
89, X
90, 11
91, X
92, 5
93, X
94, 3
95, 2
96, 5
97, X
98, 3
99, 2
100, 3

2, 7, X, 5, X, 3, 2, 3, 2, 7, X, 5, X, 3, 2, 5, X, 3, 2, 3, 2, 7, X, 5, X, 3, 2, 5, X, 3, 2, 7, X, 5, X, 3, 2, 13, X, 11, X, 5, X, 3, 2, 5, X, 3, 2, 3

Hint:
Spoiler:
I have a counter example to 2^n => 3.
"You are not running off with Cow-Skull Man Dracula Skeletor!"
-Socrates

Schrödinger's Wolves
Posts: 14
Joined: Fri Mar 24, 2017 3:28 am UTC

### Re: Guess the Pattern

Patterns I'm finding:
Spoiler:
I'm guessing this has something to do with primes, because all outputs are primes, which is further supported by your accidental inclusion of 11 before taking it back. All odd numbers either map to 2 or nothing. All even numbers either map to 3, 5, or 7 in the given sequence. I would guess that if more numbers map to eleven and any other prime they would also be odd, because your eleven was accidentally mapped to an odd number, and the fact that you would indeed accidentally put an 11 suggests that an 11 appears somewhere further on in the sequence. Patterns from odd/even numbers
Odd: 2,2,2,X,2,2,X,2,2,X,2,X,X,2,2,X,X,2,X,2,2,X,2,X,X
Even:3,3,5,3,3,5,3,3,5,3,7,5,3,3,7,5,3,5,3,3,5,3,7,5,3
Patterns I notice: every multiple of six maps to 5 except for 30, which maps to 7. Also two after every 7 comes a five. And two after every five comes a 3. Between each of those comes an X
Algorithm that comes close to yours: for each number, find the smallest prime that doesn't divide it. Then using consecutive numbers count down from that prime until you reach 2, where if the count isn't at a prime number return X. Then on the next number after the one mapped to 2 start over again and find the lowest prime number that doesn't divide it. This doesn't work for 22 or 46 in your sequence though, as 5 doesn't divide either of those and yet they both map to 7.
Converting to a sequence of these counting down primes, each number n represents a sequence starting with the nth prime
1,2,2,3,2,3,2,3,4,2,4,3,2,3,4
I also can't help but notice that the numbers that recieve an X are all either primes or squares of primes, except for 33.
Edit: Some of these have been blown out of the water by the most recent post, but I'm too tired to go further today.

Posts: 809
Joined: Sat Oct 27, 2007 5:51 pm UTC

### Re: Guess the Pattern

I'm happy to see a pattern puzzle where the answer can't possibly be a high-degree polynomial.
Let's have a fervent argument, mostly over semantics, where we all claim the burden of proof is on the other side!

jewish_scientist
Posts: 1034
Joined: Fri Feb 07, 2014 3:15 pm UTC

### Re: Guess the Pattern

I decided to give you guys some help and post some more numbers. I figured that even though most patterns should be solvable given 100 numbers, my pattern still gives really low numbers. I thought jumping to 1,000 would return numbers high enough to make the pattern easier to see, but nope. Still returns small stuff regularly. The biggest output between 1,000 and 1,100 is 19. So then I decided to jump to a million and got slightly better results. I even went to Wolfram Alpha and entered a simplified version, skipped to a trillion and STILL got small values small. I do not actually have a program written out to calculate the algorithm for me and I have a general rule to not do any calculations by hand that involve numbers in the trillions, so I do not know what the actually outputs would be. A cursory glance tells me that the outputs between 10^12 and 10^12 + 500 will be between 2 and ~120, with an average of ~30.

Spoiler:
1,000, 13
1,001, X
1,002, 11
1,003, X
1,004, 5
1,005, X
1,006, 3
1,007, 2
1,008, 5
1,009, X
1,010, 3
1,011, 2
1,012, 7
1,013, X
1,014, 5
1,015, X
1,016, 3
1,017, 2
1,018, 3
1,019, 2
1,020, 11
1,021, X
1,022, 11
1,023, X
1,024, 7
1,025, X
1,026, 5
1,027, X
1,028, 3
1,029, 2
1,030, 3
1,031, 2
1,032, 7
1,033, X
1,034, 5
1,035, X
1,036, 3
1,037, 2
1,038, 11
1,039, X
1,040, 11
1,041, X
1,042, 7
1,043, X
1,044, 5
1,045, X
1,046, 3
1,047, 2
1,048, 3
1,049, 2
1,050, 11
1,051, X
1,052, 11
1,053, X
1,054, 7
1,055, X
1,056, 5
1,057, X
1,058, 3
1,059, 2
1,060, 3
1,061, 2
1,062, 7
1,063 X
1,064, 5
1,065, X
1,066, 3
1,067, 2
1,068, 19
1,069, X
1,070, 17
1,071, X
1,072, 19
1,073, X
1,074, 13
1,075, X
1,076, 11
1,077, X
1,078, 13
1,079, X
1,080, 11
1,081, X
1,082, 5
1,083, X
1,084, 3
1,085, 2
1,086, 5
1,087, X
1,088, 3
1,089, 2
1,090, 3
1,091, 2
1,092, 5
1,093, X
1,094 3
1,095, 2
1,096, 7
1,097, X
1,098, 5
1,099, X
1,100, 3

13, X, 11, X, 5, X, 3, 2, 5, X, 3, 2, 7, X5, X, 3, 2, 3, 2, 11, X, 11, X, 7, X, 5X, 3, 2, 3, 2, 7, X, 5, X, 3, 2, 11, X, 11, X, 7, 5, X, 3, 2, 3, 2, 11, X, 11, X, 7, X, 5, X, 3, 2, 3, 2, 7, X, 5, X, 3, 2, 19, X, 17, X, 19, X, 13, X, 11, X, 13X, 11, X, , 5, X, 3, 2, 5, X, 3, 2, 3, 2, 5, X, 3, 2, 7, X, 5, 3,

Spoiler:
10^6, 3
10^6+1, X
10^6+2, 31
10^6+3, X
10^6+4, 29
10^6+5, X
10^6+6, 31
10^6+7, X
10^6+8, 29
10^6+9, X
10^6+10, 23
10^6+11, X
10^6+12, 109
10^6+13, X
10^6+14, 19
10^6+15, X
10^6+16, 17
10^6+17, X
10^6+18, 19
10^6+19, X
10^6+20, 17
10^6+21, X
10^6+22, 11
10^6+23, X
10^6+24, 13
10^6+25, X
10^6+26, 11
10^6+27, X
10^6+28, 11
10^6+29, X
10^6+30, 3
10^6+31, 2
10^6+32, 5
10^6+33, X
10^6+34, 3
10^6+35, 2
10^6+36, 3
10^6+37, 2
10^6+38, 43
10^6+39, X
10^6+40, 41
10^6+41, X
10^6+42, 79
10^6+43, X
10^6+44, 37
10^6+45, X
10^6+46, 53
10^6+47, X
10^6+48, 73
10^6+49, X
10^6+50, 31
10^6+51, X
10^6+52, 29
10^6+53, X
10^6+54, 67
10^6+55, X
10^6+56, 43
10^6+57, X
10^6+58, 23
10^6+59, X
10^6+60, 61
10^6+61, X
10^6+62, 19
10^6+63, X
10^6+64, 17
10^6+65, X
10^6+66, 67
10^6+67, X
10^6+68, 13
10^6+69, X
10^6+70, 11
10^6+71, X
10^6+72, 61
10^6+73, X
10^6+74, 7
10^6+75, X
10^6+76, 5
10^6+77, X
10^6+78, 3
10^6+79, 2
10^6+80, 19
10^6+81, X
10^6+82, 17
10^6+83, X
10^6+84, 37
10^6+85, X
10^6+86, 13
10^6+87, X
10^6+88, 11
10^6+89, X
10^6+90, 31
10^6+91, X
10^6+92, 29
10^6+93, X
10^6+94, 5
10^6+95, X
10^6+96, 3
10^6+97, 2
10^6+98, 19
10^6+99, X
10^6+100, 17
10^6+101, X
10^6+102, 19
10^6+103, X
10^6+104, 13
10^6+105, X
10^6+106, 11
10^6+107, X
10^6+108, 13
10^6+109, X
10^6+110, 7
10^6+111, X
10^6+112, 5
10^6+113, X
10^6+114, 3
10^6+115, 2
10^6+116, 5
10^6+117, X
10^6+118, 3
10^6+119, 2
10^6+120, 13
10^6+121, X
10^6+122, 11
10^6+123, X
10^6+124, 47
10^6+125, X
10^6+126, 7
10^6+127, X
10^6+128, 5
10^6+129, X
10^6+130, 3
10^6+131, 2
10^6+132, 19
10^6+133, X
10^6+134, 17
10^6+135, X
10^6+136, 23
10^6+137, X
10^6+138, 13
10^6+139, X
10^6+140, 11
10^6+141, X
10^6+142, 17
10^6+143, X
10^6+144, 7
10^6+145, X
10^6+146, 5
10^6+147, X
10^6+148, 3
10^6+149, 2
10^6+150, 37
10^6+151, X
10^6+152, 7
10^6+153, X
10^6+154, 5
10^6+155, X
10^6+156, 3
10^6+157, 2
10^6+158, 13
10^6+159, X
10^6+160, 11
10^6+161, X
10^6+162, 31
10^6+163, X
10^6+164, 7
10^6+165, X
10^6+166, 5
10^6+167, X
10^6+168, 3
10^6+169, 2
10^6+170, 13
10^6+171, X
10^6+172, 11
10^6+173, X
10^6+174, 13
10^6+175, X
10^6+176, 7
10^6+177, X
10^6+178, 5
10^6+179, X
10^6+180, 3
10^6+181, 2
10^6+182, 5
10^6+183, X
10^6+184, 3
10^6+185, 2
10^6+186, 7
10^6+187, X
10^6+188, 5
10^6+189, X
10^6+190, 3
10^6+191, 2
10^6+192, 7
10^6+193, X
10^6+194, 5
10^6+195, X
10^6+196, 3
10^6+197, 2
10^6+198, 13
10^6+199, X
10^6+200, 11

3, X, 31, X, 29, X, 31, X, 29, X, 23, X, 109, X, 19, X, 17, X, 19, X, 17, X, 11, X, 13, X, 11, X, 11, X, 3, 2, 5, X, 3, 2, 3, 2, 43, X, 41, X, 79, X, 37, X, 53, X, 73, X, 31, X, 29, X, 67, X, 43, X, 23, X, 61, X, 19, X, 17, X, 67, X, 13, X, 11, X, 61, X, 7, X, 5, X, 3, 2, 19, X, 17, X, 37, X, 13, X, 11, X, 31, X, 29, X, 5, X, 3, 2, 19, X, 17, X, 19, X, 13, X, 11, X, 13, X, 7, X, 5, X, 3, 2, 5, X, 3, 2, 13, X, 11, X, 47, X, 7, X, 5, X, 3, 2, 19, X, 17, X, 23, X, 13, X, 11, X, 17, X, 7, X, 5, X, 3, 2, 37, , 7, X, 5, X, 3, 2, 13, X, 11, X, 31, X, 7, X, 5, X, 3, 2, 13, X, 11, X, 13, X, 7, X, 5, X, 3, 2, 5, X, 3, 2, 7, X, 5, X, 3, 2, 7, X, 5, X, 3, 2, 13, X, 11
"You are not running off with Cow-Skull Man Dracula Skeletor!"
-Socrates

sfwc
Posts: 225
Joined: Tue Mar 29, 2011 1:41 pm UTC

### Re: Guess the Pattern

A further observation, which narrows things down quite a lot:
Spoiler:
The output for n is always a prime p such that n + p is also prime. Furthermore, the output is almost always the smallest prime p such that n+p is prime, with the exceptions being at 90, 1002, 1080, 10^6 + 1, 10^6 + 12, 10^6 + 20, 10^6 + 26, 10^6 + 28 and 10^6 + 92.

Tirear
Posts: 38
Joined: Fri Feb 05, 2016 5:42 pm UTC

### Re: Guess the Pattern

1,042, 7
1,043, X
1,044, 5
1,045, X
1,046, 3
7, 5, X, 3

There seem to be discrepancies in the newest batch as well.

-----

Spoiler:
10^6, 3
10^6+1, X

Huh. I expected it to be significant that an X shows up IFF the previous output was bigger than three, but I guess that pattern must have been a fluke of the limited samples we had before now.

jewish_scientist
Posts: 1034
Joined: Fri Feb 07, 2014 3:15 pm UTC

### Re: Guess the Pattern

sfwc wrote:Furthermore, the output is almost always the smallest prime p such that n+p is prime...

That actually is the pattern. The 'exceptions' are actually mistakes on my part, but give me a break. I calculated 400 outputs by hand and made 10 mistakes.

Now for the hidden second question! Can you make an algorithm that produces this pattern as a sequence without any Xs? I could not find an answer that did not have some kind of counter keeping track of how many Xs had been skipped, which means that to calculate term N, every term less than N had to calculated first.
"You are not running off with Cow-Skull Man Dracula Skeletor!"
-Socrates

Poker
Posts: 60
Joined: Fri Jun 15, 2007 2:33 am UTC
Location: Multiple Places (only one now that you read this...)

### Re: Guess the Pattern

Spoiler:
If we are able to calculate, as a function f, the number of primes less than or equal to a given number x, then we could iterate x0 = x, xi+1 = x+f(xi) until it converges, and use it to calculate our term N (or something similar to this method). After all, the only way an odd number will give an output of X is if it is two less than a composite number. However, there is one potential issue: what if an even number gives an output of X? That is, what if there is some even number that is not the difference of two primes? Maybe someone can point out a proof, but as far as I know this is still an open question.

jewish_scientist
Posts: 1034
Joined: Fri Feb 07, 2014 3:15 pm UTC

### Re: Guess the Pattern

Could you please explain that again? I do not understand. Also, there is a conjecture (I forget what it is called) that is generally accepted as true that if E is any even number and P is a prime number, then there are an infinite number of solutions to the equation E + P1 = P2
"You are not running off with Cow-Skull Man Dracula Skeletor!"
-Socrates

Poker
Posts: 60
Joined: Fri Jun 15, 2007 2:33 am UTC
Location: Multiple Places (only one now that you read this...)

### Re: Guess the Pattern

Second point first: yes, that is a conjecture, and it is generally accepted as true, but to the best of my knowledge it has not yet actually been proved. If that conjecture happens to be false, the algorithm needs to be modified to take that into account.

First point second: Admittedly I misspoke in my statement of what I was looking for, I'll try again here.

Spoiler:
Suppose we have a function f(x) that outputs the number of primes less than or equal to x. Say we have some odd number 2x+1 and want to determine how many odd composite numbers are less than or equal to it. You would just take the number of odd positive integers (x+1) and subtract the number of primes less than or equal to 2x+1 (f(2x+1)) - in other words, calculate x+1-f(2x+1). This works because there is only one odd number that is neither prime nor composite (1), and there is only one prime number that is not odd (2), so those two cancel out in the count. By the same reasoning, for an even number 2x, we can find the number of odd composite numbers by calculating x-f(2x). Let the function that does this, that calculates the number of odd composite numbers less than or equal to x, be g(x). (Of course, this function may do weird things with values of x less than 2, but we are not considering the function for any values of x less than 3 anyway.)

Here is where the iteration happens. First, let x0=x. Then, for all i>0, let xi=x+g(xi-1). In other words, we skip however many odd composite numbers are less than x, when getting to x1. But in doing so, we may encounter new odd composite numbers that we need to skip, which is why we repeat the process and go to x2, and so on until the numbers stop increasing. This iterative function is a new function, that maps the set of positive integers to the set of positive integers that are not odd composites, in order. Let this function be h(x).

From this point, since the numbers we want to skip are those two less than odd composites, for any x, let y=h(x+2)-2, and then calculate the value for that y.

jewish_scientist
Posts: 1034
Joined: Fri Feb 07, 2014 3:15 pm UTC

### Re: Guess the Pattern

Thank you very much for the explanation. I have some more questions.

Spoiler:
Poker wrote:Of course, this function may do weird things with values of x less than 2, but we are not considering the function for any values of x less than 3 anyway.

That may be a problem. Something I realized last night is that using 0 and negative numbers as inputs results in outputs that can be, but are not always, invalid (a.k.a. what I represent as 'X' in my examples). The exact definition of the pattern is [ T = P < Pminimized - N ], where 'T' is the term, 'N' is the term number, and 'P' is a prime number. As an algorithm, 'N' is the input and 'T' is the output.

It should be noted that the inequality is very important. Say that the for my algorithm, inputting 'A' results in 'B'. When 'B' is the input of a different algorithm the result is 'C'. Someone may think that putting '-A' in my algorithm would result in 'C'. This is incorrect, although it is an understandable mistake. I thought it was true until I wrote out the equation and started mapping negative numbers.

I made the pattern when I wondered what would happen if you listed the smallest twin prime, then cousin prime, then sexy prime... Eventually I decided that 2 can also be considered a sibling prime. This means that the smallest prime with the correct property is the output. Therefor, the smaller of a pair of sibling primes must be the answer.

Here are some inputs and outputs.

0, 2
-1, 2
-2, 3
-3, 2
-4, 3
-5, 2
-6, 5
-7, X
-8, 3
-9, 2
-10,3

P.S. Did you know that you cannot put a spoiler in a spoiler? The site does not match [ spoiler] to [ /spoiler] correctly, which I find rather funny considering the site's intended audience.

Quick aside: What is the correct mathematical notation meaning "The smallest possible value".

Spoiler:
Then, for all i>0, let xi= x +g(xi-1).

Unless I am missing something, which I probably am, you forgot to define x (a.k.a. the variable I made really big). This is not just me being a strangely well educated troll, I actual do not understand what you mean here. I am going to assume that you meant to put 'i'. Also, I think you put a '+' where you actually meant to put a '-'.

Spoiler:
In other words, we skip however many odd composite numbers are less than x, when getting to x1. But in doing so, we may encounter new odd composite numbers that we need to skip, which is why we repeat the process and go to x2, and so on until the numbers stop increasing.

If we are skipping numbers, why is the value increasing.

Spoiler:
From this point, since the numbers we want to skip are those two less than odd composites, for any x, let y=h(x+2)-2, and then calculate the value for that y.

I do not understand this. This is probably because I do not understand what came before it.
"You are not running off with Cow-Skull Man Dracula Skeletor!"
-Socrates

Poker
Posts: 60
Joined: Fri Jun 15, 2007 2:33 am UTC
Location: Multiple Places (only one now that you read this...)

### Re: Guess the Pattern

jewish_scientist wrote:Thank you very much for the explanation. I have some more questions.

Spoiler:
Poker wrote:Of course, this function may do weird things with values of x less than 2, but we are not considering the function for any values of x less than 3 anyway.

That may be a problem. Something I realized last night is that using 0 and negative numbers as inputs results in outputs that can be, but are not always, invalid (a.k.a. what I represent as 'X' in my examples). The exact definition of the pattern is [ T = P < Pminimized - N ], where 'T' is the term, 'N' is the term number, and 'P' is a prime number. As an algorithm, 'N' is the input and 'T' is the output.

It should be noted that the inequality is very important. Say that the for my algorithm, inputting 'A' results in 'B'. When 'B' is the input of a different algorithm the result is 'C'. Someone may think that putting '-A' in my algorithm would result in 'C'. This is incorrect, although it is an understandable mistake. I thought it was true until I wrote out the equation and started mapping negative numbers.

I made the pattern when I wondered what would happen if you listed the smallest twin prime, then cousin prime, then sexy prime... Eventually I decided that 2 can also be considered a sibling prime. This means that the smallest prime with the correct property is the output. Therefor, the smaller of a pair of sibling primes must be the answer.

Here are some inputs and outputs.

0, 2
-1, 2
-2, 3
-3, 2
-4, 3
-5, 2
-6, 5
-7, X
-8, 3
-9, 2
-10,3

P.S. Did you know that you cannot put a spoiler in a spoiler? The site does not match [ spoiler] to [ /spoiler] correctly, which I find rather funny considering the site's intended audience.

Quick aside: What is the correct mathematical notation meaning "The smallest possible value".

Spoiler:
I'm not entirely sure where you're going with this. Could you give an example of where term N and term -N are unequal?

jewish_scientist wrote:
Spoiler:
Then, for all i>0, let xi= x +g(xi-1).

Unless I am missing something, which I probably am, you forgot to define x (a.k.a. the variable I made really big). This is not just me being a strangely well educated troll, I actual do not understand what you mean here. I am going to assume that you meant to put 'i'. Also, I think you put a '+' where you actually meant to put a '-'.

Spoiler:
What I am doing here, is creating a function h(x), that maps each value x to a value y, in order, excluding those numbers that are odd composites. In other words, h(7)=7, since there are no odd composites less than or equal to 7. h(8)=8 for the same reason. However, h(9)=10, skipping the number 9. The purpose for creating this function is to allow us to skip odd composite values. It's an index function, so to speak.

jewish_scientist wrote:
Spoiler:
In other words, we skip however many odd composite numbers are less than x, when getting to x1. But in doing so, we may encounter new odd composite numbers that we need to skip, which is why we repeat the process and go to x2, and so on until the numbers stop increasing.

If we are skipping numbers, why is the value increasing.

Spoiler:
This question is probably answered by my above explanation: we are not yet calculating your pattern itself. What we are doing is setting up an index function that allows us to skip the X's. So when we skip a particular value, 25, the index will move up to the next value, i.e. 26.

jewish_scientist wrote:
Spoiler:
From this point, since the numbers we want to skip are those two less than odd composites, for any x, let y=h(x+2)-2, and then calculate the value for that y.

I do not understand this. This is probably because I do not understand what came before it.

Spoiler:
The point of the +2/-2 part is so that when we put in 7 for x, we get h(9), which evaluates to 10, then subtract 2 to get 8. The seventh non-X value is the one we get when you plug in 8.

jewish_scientist
Posts: 1034
Joined: Fri Feb 07, 2014 3:15 pm UTC

### Re: Guess the Pattern

Poker wrote:I'm not entirely sure where you're going with this. Could you give an example of where term N and term -N are unequal?

'N' and '-N' will always give the same value, but it is a very reasonable mistake to think the opposite. In order for a number to be the output, it must be a sibling. Someone could say, 'Positive numbers give the smaller sibling and negative numbers give the larger sibling of the same pair.' This is wrong, because output is always the smallest number that exists in a pair. Although, I looked back at my equation and I think it is wrong. I'll have to review it some more.

Insert Stuff
What I am doing here, is creating a function h(x), that maps each value x to a value y, in order, excluding those numbers that are odd composites. In other words, h(7)=7, since there are no odd composites less than or equal to 7.

Let me work through this step by step:
Spoiler:
h(11) = ?
x = 11
x0 = 0

x1 = 11 + g(x1-1)
x1 = 11 + g(x0)
x1 = 11 + g(0)
x1 = 11 + 0 = 11

x2 = 11 + g(x2-1)
x2 = 11 + g(x1)
x2 = 11 + g(11)
x2 = 11 + 1 = 12

x3 = 11 + g(x3-1)
x3 = 11 + g(x2)
x3 = 11 + g(12)
x3 = 11 + 1 = 12

x4 = 11 + g(x4-1)
x4 = 11 + g(x3)
x4 = 11 + g(12)
x4 = 11 + 1 = 12

x4 = x3
return x3
h(11) = 12

Is this correct?
"You are not running off with Cow-Skull Man Dracula Skeletor!"
-Socrates

Poker
Posts: 60
Joined: Fri Jun 15, 2007 2:33 am UTC
Location: Multiple Places (only one now that you read this...)

### Re: Guess the Pattern

jewish_scientist wrote:
Poker wrote:I'm not entirely sure where you're going with this. Could you give an example of where term N and term -N are unequal?

'N' and '-N' will always give the same value, but it is a very reasonable mistake to think the opposite. In order for a number to be the output, it must be a sibling. Someone could say, 'Positive numbers give the smaller sibling and negative numbers give the larger sibling of the same pair.' This is wrong, because output is always the smallest number that exists in a pair. Although, I looked back at my equation and I think it is wrong. I'll have to review it some more.

Ok, I think I was misinterpreting what you were saying, that's all.

jewish_scientist wrote:
Insert Stuff
What I am doing here, is creating a function h(x), that maps each value x to a value y, in order, excluding those numbers that are odd composites. In other words, h(7)=7, since there are no odd composites less than or equal to 7.

Let me work through this step by step:
Spoiler:
h(11) = ?
x = 11
x0 = 0

x1 = 11 + g(x1-1)
x1 = 11 + g(x0)
x1 = 11 + g(0)
x1 = 11 + 0 = 11

x2 = 11 + g(x2-1)
x2 = 11 + g(x1)
x2 = 11 + g(11)
x2 = 11 + 1 = 12

x3 = 11 + g(x3-1)
x3 = 11 + g(x2)
x3 = 11 + g(12)
x3 = 11 + 1 = 12

x4 = 11 + g(x4-1)
x4 = 11 + g(x3)
x4 = 11 + g(12)
x4 = 11 + 1 = 12

x4 = x3
return x3
h(11) = 12

Is this correct?

Spoiler:
Technically x0 = x, not 0, but when x0 = 0, x1 would equal x anyway, so all that does is delay it a step - the result is still the same. Also, you could've stopped at x3 since x2 = x3, but the result is still the same. Neither of those "mistakes" change the result, nor to the best of my knowledge would they ever change the result, so yes, that is correct.

jewish_scientist
Posts: 1034
Joined: Fri Feb 07, 2014 3:15 pm UTC

### Re: Guess the Pattern

Poker wrote:From this point, since the numbers we want to skip are those two less than odd composites, for any x, let y=h(x+2)-2, and then calculate the value for that y.

x = 9
y = h(9 + 2) - 2
y = h( 11 ) - 2
y = 12 - 2
y = 10
9,10

However, the correct mapping is 9,2.
"You are not running off with Cow-Skull Man Dracula Skeletor!"
-Socrates

Poker
Posts: 60
Joined: Fri Jun 15, 2007 2:33 am UTC
Location: Multiple Places (only one now that you read this...)

### Re: Guess the Pattern

jewish_scientist wrote:
Poker wrote:From this point, since the numbers we want to skip are those two less than odd composites, for any x, let y=h(x+2)-2, and then calculate the value for that y.

x = 9
y = h(9 + 2) - 2
y = h( 11 ) - 2
y = 12 - 2
y = 10
9,10

However, the correct mapping is 9,2.

First of all, for what I'm trying to accomplish, there is one X that we're skipping (for 7), so the final output for 9 should be 3, corresponding to the 10th term of the original sequence.

Which brings me to my second point, which I now realize was not given enough emphasis/worded in a confusing manner: the function h(x) is not the end of the story. It merely tells us what term of the original sequence (X's included) should be used in the new sequence (X's excluded).

jewish_scientist
Posts: 1034
Joined: Fri Feb 07, 2014 3:15 pm UTC

### Re: Guess the Pattern

Poker wrote:Which brings me to my second point, which I now realize was not given enough emphasis/worded in a confusing manner: the function h(x) is not the end of the story. It merely tells us what term of the original sequence (X's included) should be used in the new sequence (X's excluded).

Aww, I got that now. One last more question: If M() represents my algorithm and M(x) = X, then what does h(x) equal?
"You are not running off with Cow-Skull Man Dracula Skeletor!"
-Socrates

Poker
Posts: 60
Joined: Fri Jun 15, 2007 2:33 am UTC
Location: Multiple Places (only one now that you read this...)

### Re: Guess the Pattern

jewish_scientist wrote:
Poker wrote:Which brings me to my second point, which I now realize was not given enough emphasis/worded in a confusing manner: the function h(x) is not the end of the story. It merely tells us what term of the original sequence (X's included) should be used in the new sequence (X's excluded).

Aww, I got that now. One last more question: If M() represents my algorithm and M(x) = X, then what does h(x) equal?

It will equal some y where M(y) =/= X (after taking into account the +2/-2 shifting).