cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A268338 Numbers that cycle under the following transformation: if m is even, divide by 2, if m is congruent to 1 mod 4, multiply by 3 and add 1; if m is congruent to 3 mod 4, multiply by 7 and add 1.

This page as a plain text file.
%I A268338 #34 May 22 2025 10:21:44
%S A268338 1,2,4,19,23,31,38,41,46
%N A268338 Numbers that cycle under the following transformation: if m is even, divide by 2, if m is congruent to 1 mod 4, multiply by 3 and add 1; if m is congruent to 3 mod 4, multiply by 7 and add 1.
%C A268338 Some numbers appear to grow indefinitely under these rules, but it is possible that they may eventually cycle at some point.  All numbers up to 50 either cycle or transform to another number that cycles (typically 1).  51 is the first open case: it may eventually cycle or may continue to grow indefinitely.
%e A268338 23 is a member of this sequence. 23 is congruent to 3 mod 4.  As a result, 23 transforms to 23*7+1 = 162.  From there 162 -> 81 -> 244 -> 122 -> 61 -> 184 -> 92 -> 46 -> 23.  23 is the least member of this cycle.
%e A268338 49 is not a member of this sequence because it eventually reduces to 19, which cycles.
%o A268338 (Python)
%o A268338 a = 1
%o A268338 b = 1
%o A268338 prev = []
%o A268338 keep = []
%o A268338 count = 0
%o A268338 while b < 51:
%o A268338     keep.append(a)
%o A268338     flag1 = False
%o A268338     flag2 = False
%o A268338     if a % 2 == 0:
%o A268338         a /= 2
%o A268338     elif a % 4 == 1:
%o A268338         a = a*3+1
%o A268338     else:
%o A268338         a = a*7+1
%o A268338     if count > 50:
%o A268338         b += 1
%o A268338         a = b
%o A268338         count = 0
%o A268338         keep = []
%o A268338     if keep.count(a) == 2 and a not in prev and a <= 50:
%o A268338         prev.append(a)
%o A268338         count = 0
%o A268338         keep = []
%o A268338         b += 1
%o A268338         a = b
%o A268338     count += 1
%o A268338 print(sorted(prev))
%o A268338 # _David Consiglio, Jr._, Feb 01 2016
%Y A268338 Cf. A267703, A267970, A267969, A006666, A006370, A005186, A267970, A232711.
%K A268338 nonn,more
%O A268338 1,2
%A A268338 _David Consiglio, Jr._, Feb 01 2016
%E A268338 Corrected and edited by _David Consiglio, Jr._, Apr 20 2016