How to turn this sequence into a formula?

1. Apr 21, 2014

pondzo

the sequence:
1,1,2,1,1,2,1,1,3,1,1,2,1,1,2,1,1,3,1,1,2,1,1,2,1,1,4,
"................................................................." 4,
"................................................................." 5,
"................................................................." 4,
"................................................................." 4,
"................................................................." 5,
"................................................................." 4,
"................................................................." 4,
"................................................................." 6, and so on, is the sequence of exponents of 3 in the prime factorization of every third element of $\mathbb Z$ starting from 3.
eg 3= 31 → 1
6= 31*2 → 1
9= 32 → 2
and these are the first three elements of the sequence
How would i go about turning this sequence into an equation, so i could say, for example, the number 666 is the 222th number in this sequence and plug 222 (or 666 for that matter, whichever) into some equation that would output the exponent for 3 in the prime factorization of the number 666 (which in the case of 666, would be 2 since 666= 37*2*32 )
Thank you!

2. Apr 21, 2014

pondzo

I'm sorry, i don't quite get it. Could you please give an example of how this function outputs numbers in the sequence?

3. Apr 21, 2014

micromass

Staff Emeritus