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!)
A346035 a(1) = 1; if a(n) is not divisible by 3, a(n+1) = 4*a(n) + 1, otherwise a(n+1) = a(n)/3. 1
1, 5, 21, 7, 29, 117, 39, 13, 53, 213, 71, 285, 95, 381, 127, 509, 2037, 679, 2717, 10869, 3623, 14493, 4831, 19325, 77301, 25767, 8589, 2863, 11453, 45813, 15271, 61085, 244341, 81447, 27149, 108597, 36199, 144797, 579189, 193063, 772253, 3089013, 1029671, 4118685 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
MATHEMATICA
a[1] = 1; a[n_] := a[n] = If[Divisible[a[n-1], 3], a[n-1]/3, 4*a[n-1]+1]; Array[a, 50] (* Amiram Eldar, Jul 12 2021 *)
PROG
(Processing)
// generates all the numbers in the sequence before it first surpasses 1 billion
int n;
void setup() {
n = 1;
noLoop();
}
void draw() {
print(n + ", ");
while (true) {
if (n % 3 == 0) {
n /= 3;
} else {
n *= 4; n++;
}
print(n);
if (n == 1 || n >= 600000000) {
break;
} else {
print(", ");
}
}
}
(PARI) a(n) = if (n==1, 1, my(x=a(n-1)); if (x % 3, 4*x+1, x/3)); \\ Michel Marcus, Aug 12 2021
CROSSREFS
Sequence in context: A156824 A053002 A053003 * A167202 A204914 A355036
KEYWORD
easy,nonn
AUTHOR
Tristan Young, Jul 02 2021
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 May 2 10:51 EDT 2024. Contains 372196 sequences. (Running on oeis4.)