login
A179738
a(n) = length of (eventual) period of the sequence defined by s(0) = 1, s(n+1) = odd_part(2n-1 + (s(n) if n odd else s(n)*3)), where odd_part = A000265.
4
1, 2, 4, 1, 4, 8, 2, 4, 8, 4, 2, 2, 1, 4, 12, 4, 4, 26, 2, 12, 6, 2, 4, 4, 4, 16, 4, 8, 10, 6, 4, 8, 4, 2, 6, 8, 12, 12, 28, 1, 22, 16, 2, 16, 12, 12, 16, 6, 4, 40, 24, 4, 32, 6, 26, 16, 6, 8, 4, 8, 12, 2, 36, 6, 46, 12, 2, 36, 60, 6, 16, 8, 4, 18, 20, 4, 60, 36
OFFSET
2,2
COMMENTS
Original definition (edited): Let x, y be odd numbers and the operation x <+> y := A000265(x+y). Consider sequence s(0) = x <+> y, s(2*k+1) = x <+> 3*s(2*k), s(2*k+2) = x <+> s(2*k+1); a(n) is the smallest period in case x = 2*n-1, y = 1.
The operation x <+> y = A000265(x+y) = odd part of x+y is also considered in A179382.
Record values are: a(2) = 1, a(3) = 2, a(4) = 4, a(7) = 8, a(16) = 12, a(19) = 26, a(40) = 28, a(51) = 40, a(66) = 46, a(70) = 60, a(111) = 64, a(126) = 70, a(147) = 80, a(162) = 96, a(225) = 120, a(379) = 170, a(619) = 184, a(640) = 228, a(727) = 248, a(759) = 256, a(916) = 348, ... - M. F. Hasler, Feb 16 2025
LINKS
Jason Yuen, Table of n, a(n) for n = 2..10000 (terms 2..1000 from M. F. Hasler)
EXAMPLE
For n = 4, 2*n-1 = 7, we get: 7 <+> 1 = 1, 7 <+> 3*1 = 5, 7 <+> 5 = 3, 7 <+> 3*3 = 1, and from here on it starts over with 7 <+> 1 = 1, etc., so the period is [1, 5, 3, 1], of length 4, whence a(4) = 4.
For n = 6, 2*n-1 = 11, we get:
11 <+> 1 = 3, 11 <+> 3*3 = 5, 11 <+> 5 = 1, 11 <+> 3*1 = 7,
11 <+> 7 = 9, 11 <+> 3*9 = 19, 11 <+> 19 = 15, 11 <+> 3*15 = 7, 11 <+> 7 = 9, ...
Thus we have an eventually periodic sequence with the smallest period 4 (with elements 7, 9, 19, 15). Thus a(6) = 4.
PROG
(PARI) apply( {A179738(n, y=1, T(y, x=2*n-1)=(x+y)>>valuation(x+y, 2))=my(s=[], P); until(, s=concat(s, y=T(3^(#s%2)*y)); for(L=1, #s\3, P=[vecextract(s, Str(-L-t, "..-", 1+t)) | t<-[0, L, 2*L]]; P[1]==P[2] && P[1]==P[3] && return(#P[1])))}, [2..90])
(Python)
def A179738(n):
s = [1]; x = 2*n-1; odd = lambda z: all(z&1 or(z:=z>>1)for _ in range(z))and z
while not(p := next((p for p in range(1, len(s)//3+1) if
s[-p:]==s[-2*p:-p]==s[-3*p:-2*p]), 0)): s.append(odd(x+3**(len(s)&1)*s[-1]))
return p
print([A179738(n)for n in range(2, 99)]) # M. F. Hasler, Feb 16 2025
CROSSREFS
KEYWORD
nonn,changed
AUTHOR
Vladimir Shevelev, Jul 25 2010
EXTENSIONS
Name edited and corrections proposed by Jason Yuen, Feb 09 2025
Edited, a(4) and a(18) corrected, and extended by M. F. Hasler, Feb 15 2025
STATUS
approved