OFFSET
1,22
COMMENTS
It appears that the sequence never goes below -1 and increases without bound.
It appears that if the first appearance of a number x occurs at index n and the first appearance of x+1 appears at index m then m/n approaches 4 as x increases.
LINKS
Kevin Ryde, PARI/GP Code and Notes.
EXAMPLE
MATHEMATICA
Block[{a = {}, s = Nest[Join[#, Drop[#, {(Length[#] + 1)/2}]] &, Range[3], 6], c}, Array[Set[c[#], 0] &, 3]; Do[c[ s[[i]] ]++; AppendTo[a, c[3] - c[2]], {i, Min[Length@ s, 104]}]; a] (* Michael De Vlieger, May 01 2021 *)
PROG
(Kotlin)
fun a(iter: Int): List<Int> = runningSum(twosVersusThrees(iter))
fun runningSum(a: List<Int>) = a.drop(1).fold(listOf(a[0])) { acc, cur ->
acc + (acc.last() + cur)
}
fun twosVersusThrees(iter: Int): List<Int> = removeMiddle(listOf(0, -1, 1), iter)
fun removeMiddle(initial: List<Int>, iter: Int): List<Int> {
if (iter < 2) return initial
val prev = removeMiddle(initial, iter-1)
return prev + prev.subList(0, (prev.size - 1) / 2) + prev.subList((prev.size + 1) /2, prev.size)
}
(PARI) See links.
CROSSREFS
KEYWORD
sign
AUTHOR
Matthew Malone, Apr 15 2021
STATUS
approved