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

 


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A320020 Numbers whose Collatz trajectory always alternates between a halving and a tripling step until a power of 2 is reached. 1
1, 2, 3, 4, 5, 6, 8, 10, 16, 21, 32, 42, 64, 85, 128, 151, 170, 227, 256, 302, 341, 454, 512, 682, 1024, 1365, 2048, 2730, 4096, 5461, 8192, 10922, 14563, 16384, 21845, 29126, 32768, 43690, 65536, 87381, 131072, 174762, 262144, 349525, 524288, 699050, 932067
(list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Any number whose Collatz trajectory has two or more consecutive halving steps (before reaching a power of 2) is not included in this sequence.
The b-file was generated using the reverse Collatz algorithm.
Instead of going: n -> 3n + 1 (if odd), n/2 (if even), this algorithm starts from a power of 2 and goes: n -> (n - 1)/3 (if possible) and n*2, repeating these two consecutive steps as long as the number n is divisible by 3. The results are progressively added to a dynamic array, which gets sorted by ascending order once the algorithm terminates.
Example 1: 8 -> (8 - 1) and the calculation stops because 7 isn't divisible by 3. No numbers are added to the dynamic array.
Example 2: 16 -> (16 - 1)/3 = 5; 5*2 = 10; (10 - 1)/3 = 3; 3*2 = 6; (6 - 1) and the calculation stops because 5 isn't divisible by 3. The numbers 5, 10, 3, 6 are then added to the dynamic array.
Example 3: 64 -> (64 - 1)/3 = 21; 21*2 = 42; (42 - 1) and the calculation stops because 41 isn't divisible by 3. The numbers 21 and 42 are then added to the dynamic array.
LINKS
EXAMPLE
6 is in the sequence because 6/2 = 3 (halving step); 3*3 + 1 = 10 (tripling step); 10/2 = 5 (halving step); 5*3 + 1 = 16 (tripling step) and a power of 2 is reached.
7 is not in this sequence because 7*3 + 1 = 22 (tripling step); 22/2 = 11 (halving step); 11*3 + 1 = 34 (tripling step); 34/2 = 17 (halving step); 17*3 + 1 = 52 (tripling step); 52/2 = 26 (halving step); 26/2 = 13 (another halving step).
PROG
(PARI) isp2(n) = (n==1) || (n==2) || (ispower(n, , &p) && (p==2));
isok(n) = {while (! isp2(n), if (n % 2, newn = (3*n+1), newn = n/2); if (((n % 2) == (newn % 2)), return (0)); n = newn; ); return (1); } \\ Michel Marcus, Oct 07 2018
(Java) for(BigInteger pow = TWO; pow.compareTo(END) < 0; pow = pow.multiply(TWO)) {
terms.add(pow); //otherwise numbers like 8, 32, 128, etc. aren't added
BigInteger newPow = pow.subtract(ONE);
while(newPow.mod(THREE).compareTo(ZERO) == 0) {
terms.add(newPow.add(ONE));
newPow = newPow.divide(THREE);
terms.add(newPow);
newPow = newPow.add(newPow);
terms.add(newPow);
newPow = newPow.subtract(ONE);
}
}
terms.sort(Comparator.naturalOrder()); //sorting by ascending order
for(int i = 1; i < terms.size(); i++) {
if(terms.get(i).compareTo(terms.get(i - 1)) == 0) {
terms.remove(i); //to remove duplicates
}
}
CROSSREFS
Cf. A006577.
Sequence in context: A129976 A105181 A263361 * A229034 A265406 A096120
KEYWORD
nonn
AUTHOR
Alessandro Polcini, Oct 03 2018
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | 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 September 19 09:30 EDT 2024. Contains 376007 sequences. (Running on oeis4.)