%I #23 Jul 07 2020 05:48:28
%S 1,2,3,7,5,4,15,9,6,13,8,21,12,43,23,157,80,41,22,133,68,35,19,11,259,
%T 131,67,1191,597,300,151,77,40,421,212,107,55,29,16,73,38,20,111,57,
%U 30,241,122,62,32,17,10,31,273,138,70,36,343,173,88,45,24,1885
%N To calculate a(n), iterate the function f(x) = x * ceiling(a(n-1) / 2) + 1 on the value x = 1 until the result has not appeared in the sequence previously. Take a(1) = 1.
%C By definition, this sequence never repeats its values.
%H Omer Demir, <a href="/A335292/b335292.txt">Table of n, a(n) for n = 1..10000</a>
%e a(6) = 4. Therefore, ceiling(a(6) / 2) is equal to 2, and a(7) should be 1 * 2 + 1 = 3. However, since 3 can already be found in the sequence (coincidentally, at position n = 3), one must iterate the function again to get a(7) = 3 * 2 + 1 = 7. But 7 is also already in the sequence (at position n = 4), so the function must be iterated once more to find that a(7) is indeed equal to 7 * 2 + 1 = 15.
%o (Python 3)
%o from math import ceil
%o sequence = [1]
%o terms = 1000
%o for n in range(2, terms + 1):
%o nextnum = 1
%o while nextnum in sequence:
%o nextnum = nextnum * ceil(sequence[-1] / 2) + 1
%o sequence.append(nextnum)
%o print(sequence)
%K nonn
%O 1,2
%A _Omer Demir_, May 30 2020
|