login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A334840 a(1) = 1, a(n) = a(n-1)/gcd(a(n-1),n) if this gcd is > 1, else a(n) = 4*a(n-1). 0
1, 4, 16, 4, 16, 8, 32, 4, 16, 8, 32, 8, 32, 16, 64, 4, 16, 8, 32, 8, 32, 16, 64, 8, 32, 16, 64, 16, 64, 32, 128, 4, 16, 8, 32, 8, 32, 16, 64, 8, 32, 16, 64, 16, 64, 32, 128, 8, 32, 16, 64, 16, 64, 32, 128, 16, 64, 32, 128, 32, 128, 64, 256, 4, 16 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
A variant of A133058. - Ctibor O. Zizka, Apr 14 2023
LINKS
FORMULA
a(n) = 2^((n mod 2) + A000120(n) + 1), for n >= 2. - Ctibor O. Zizka, Apr 15 2023
a(n) = 2*A001316(n)*(n mod 2 + 1), for n >= 2. - Ctibor O. Zizka, Apr 15 2023
EXAMPLE
a(2) = 4*a(1) = 4, a(3) = 4*a(2) = 16, a(4) = a(3)/4 = 4, a(5) = 4*a(4) = 16, ...
MATHEMATICA
a[1] = 1; a[n_] := a[n] = If[(g = GCD[a[n-1], n]) > 1, a[n-1]/g, 4*a[n-1]]; Array[a, 100] (* Amiram Eldar, May 13 2020 *)
PROG
(Magma) a:=[1]; for n in [2..70] do if Gcd(a[n-1], n) eq 1 then Append(~a, 4* a[n-1]); else Append(~a, a[n-1] div Gcd(a[n-1], n)); end if; end for; a; // Marius A. Burtea, May 13 2020
(PARI) lista(nn) = {my(va = vector(nn)); va[1] = 1; for (n=2, nn, my(g = gcd(va[n-1], n)); if (g > 1, va[n] = va[n-1]/g, va[n] = 4*va[n-1]); ); va; } \\ Michel Marcus, May 17 2020
(Python)
from itertools import count, islice
from math import gcd
def A334840_gen(): # generator of terms
yield (a:=1)
for n in count(2):
yield (a:=a<<2 if (b:=gcd(a, n)) == 1 else a//b)
A334840_list = list(islice(A334840_gen(), 30)) # Chai Wah Wu, Mar 18 2023
CROSSREFS
Sequence in context: A065659 A305833 A110650 * A232515 A010295 A059152
KEYWORD
nonn
AUTHOR
Ctibor O. Zizka, May 13 2020
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 09:04 EDT 2024. Contains 371240 sequences. (Running on oeis4.)