# Another one of those odd sequence puzzles

This is an interesting one.
I will do the same thing that I usually do.
After one week, a hint. After 2 weeks, a hint. After 3 weeks, an answer.

I may change this system.

What number goes in the question mark, and why does it go there?

0,0,1,2,3,1,3,2,3,3,4,2,4,4,3,3,4,4,5,3,5,4,5,3,5,5,4,4,5,?

HINT:

There is a inputting function that each number is put into... when you undo that function, you get a simple sequence.

HINT 2:

If you take this inputting function onto 24862486 you get 4. I will take the next three requests of inputting from the comments.

HINT 3:

This has to do with prime factors.

HINT 4:

It requires the repeated use of a single function.

HINT 5:

This function is related to the Greatest Prime Factor

• Is it something to do with the word for each number? Commented Mar 26, 2015 at 12:51
• may be answer is 5? Commented Apr 24, 2015 at 11:48
• @awesomepi So either you could put a bounty to attract attention, or just post the answer. Commented Apr 30, 2015 at 14:27
• can you give me the values for inputs 8 , 29862968, 191199 . ( you said you ll pick from the comments right? ) Commented Apr 30, 2015 at 16:33
• Can you give me the values for 1, 3, 5 ? Commented May 6, 2015 at 16:51

import Data.Numbers.Primes

seqFun 1 = 0
seqFun input = recWhile input 0
where
recWhile a n = res
where
pfs = primeFactors a
modN = n+1
maxPF = maximum pfs
res
| a < 2 = modN
| maxPF == 2 = modN
| otherwise = recWhile (maxPF + 1) modN

fibs = 1:1:(zipWith (+) fibs (tail fibs))
thirtyFibs = take 30 fibs
main = print $map seqFun thirtyFibs Just run main to see the entire sequence. Note that many of the hints were not true; the function is not related to the Greatest Common Factor, and the hints for 29862968 and 191199 were incorrect. For fun, here's a much shorter version: import Data.Numbers.Primes seqFun = length . takeWhile (>3) . iterate (succ.maximum.primeFactors) fibs = 1:1:(zipWith (+) fibs (tail fibs)) main = print$ map seqFun (take 30 fibs)

This version doesn't work for 2 or 3, though.

• I'm sorry, this was a poorly written question. On the Greatest Common Factor, I meant to write "Greatest Prime Factor" Commented Jun 2, 2015 at 23:20
• No worries! I had fun working with it, trying to combine primeFactors, gcd, and other functions and feeling like I was getting closer. Commented Jun 4, 2015 at 17:24
• How about an English language version of the answer. Commented Jun 5, 2015 at 1:12
• Certainly! puzzling.stackexchange.com/a/15810/12927 I prefer the code version since I can easily test lots of numbers with it. Commented Jun 5, 2015 at 1:32

As an extension to MisterEman22's "what we know so far," hint #4 specifies that the function has to do with prime factors, so I added the prime factorization of each input to the table, in case it helps someone else.

1                    1   0
2                    2   1
8                2*2*2   1
3                    3   2
7                    7   2
21                  3*7   2
144          2*2*2*2*3*3   2
5                    5   3
13                   13   3
34                 2*17   3
55                 5*11   3
610               2*5*61   3
987               3*7*47   3
6765            3*5*11*41   3
46368   2*2*2*2*2*3*3*7*23   3
89                   89   4
233                  233   4
377                13*29   4
1597                 1597   4
2584          2*2*2*17*19   4
17711               89*199   4
196418          2*17*53*109   4
317811          3*13*29*281   4
24862486      2*11*73*113*137   4
4181               37*113   5
10946             2*13*421   5
28657                28657   5
75025             5*5*3001   5
121393              233*521   5
191199          3*17*23*163   5
514229               514229   5

Note I also sorted by output value, to aid in any pattern-finding.

My guess is that the number has to do with the number of applications of a function before it reaches some final value (1).

Here's what we know so far

The number we are looking for is whatever 832040 maps to. The function is keeping the output values low, but as the input gets increasingly larger, the output is getting slightly larger

Here is a listing of what all the other terms before it are to help you out, based on the Fibonacci sequence:

1= 0

1= 0

2= 1

3= 2

5= 3

8= 1

13= 3

21= 2

34= 3

55= 3

89= 4

144= 2

233= 4

377= 4

610= 3

987= 3

1597= 4

2584= 4

4181= 5

6765= 3

10946= 5

17711= 4

28657= 5

46368= 3

75025= 5

121393= 5

196418= 4

317811= 4

514229= 5

832040= ?

And here's the non-Fibonacci numbers that he gave us:

24862486= 4

29862968= 4

191199= 5

• We also know that 191199 maps to 5, which means that numbers that aren't in the Fib sequence can be put into this function without error (more generally meaning that the function likely has nothing to do with the Fib sequence itself). Commented May 8, 2015 at 17:04
• @BaileyM Good note. I'll edit this and add in the other numbers that he gave us as well Commented May 8, 2015 at 17:07
• @MisterEman22 The 29862986 was NOT a mistype Commented May 21, 2015 at 16:23
• @awesomepi - You've just mentioned a third eight-digit number (previously we had $24862468\to 4$ and $29862968\to 4$, and in the preceding comment you mention $29862986$). Are you saying that all three of these give $4$? Commented May 26, 2015 at 3:34
• Well crap it is a mistype... I changed it to 24862486. And the 29862986 was also a mistype. I meant to say 29862968 Commented May 26, 2015 at 13:26

The inputting sequence is the Fibonacci Series (1,1,2,3,5,8,13,21......). The function, I don't know.

• Nope. 233 gives 4, while 8 gives 1. Must be something else. Commented May 7, 2015 at 12:37
• Also, 2584 gives 4, while 75025 gives 5, but they both sum to 19 Commented May 7, 2015 at 12:39
• It is the Fibonacci Series though... Commented May 7, 2015 at 14:03
• @VicAche you are right, it is not sum of numbers, and BTW, I found out it was Fibonacci series by seeing the first two numbers were 0's. Commented May 8, 2015 at 14:13
• I'm not a regular user of this website, and I'm trying to find an answer before posting one. I think the answer lies somewhere between sum of digits and number of prime factors, but I may be totally wrong. Commented May 8, 2015 at 14:22

How this sequence works:

Set your number as A, and set N as zero

While A is greater than or equal to 2,
Take the prime factorization of A
Add 1 to N and set that as N
Take the greatest prime factor
If it is 2, then break.
If it is greater than 2, set A as the greatest prime factor + 1
End
Put N as the output

• So the "hints" $29862968 \to 4$ and $191199 \to 5$ were mistaken? (Your procedure gives $29862968 \to 3$ and $191199 \to 4$.) Here's a trace when $191199$ is input, showing the output is $4$ (not $5$): $$\begin{array}{|c|c||c|} N & A & \rm{gpf}(A) \\ \hline 1&191199&163\\ 2&164&41\\ 3&42&7\\ \color{blue}{4}&8&\color{red}{2}\\ \end{array}$$ (These are the values of $N,A,$ and $\rm{gpf}(A)$ in each successive pass through the while loop, just after the statement Take the greatest prime factor.) Commented Jun 2, 2015 at 12:40