Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A125731
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A125731 a(n) = minimal number of steps to get from 1 to n, where a step is: x -> 3x+1 if x is odd, or x -> either x/2 or 3x+1 if x is even. Set a(n) = -1 if n cannot be reached from 1. +0
3
0, 2, -1, 1, 6, -1, 3, 8, -1, 5, 5, -1, 2, 15, -1, 7, 7, -1, 12, 4, -1, 4, 9, -1, 9, 9, -1, 14, 14, -1, 6, 19, -1, 6, 11, -1, 11, 11, -1, 3, 29, -1, 16, 16, -1, 8, 8, -1, 8, 21, -1, 8, 13, -1, 26, 13, -1, 13, 13, -1, 5, 31, -1, 18, 18, -1, 5, 23, -1, 10 (list; graph; listen)
OFFSET

1,2

COMMENT

In contrast to the "3x+1" problem, here you are free to chose either step if x is even.

Clearly a(3k) = -1 for all k and otherwise we conjecture that a(n) >= 0.

See A127885 for the number of steps in the reverse direction, from n to 1.

LINKS

David Applegate, Table of n, a(n) for n = 1..1000

EXAMPLE

The initial values use these paths:

1 -> 4 -> 2 -> 7 -> 22 -> 11.

1 -> 4 -> 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8.

1 -> 4 -> 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 49 -> 148 -> 74 -> 37 -> 12 -> 56 -> 28 -> 14

MAPLE

# Maple code from David Applegate: Be careful - the function takes an iteration limit and returns the limit

# if it wasn't able to determine the answer (that is, if A125731(n, lim)

# == lim, all you know is that the value is >= lim). To use it, do

# manual iteration on the limit.

A125731 := proc(n, lim) local d, d2; options remember;

if (n = 1) then return 0; end if;

if (n mod 3 = 0) then return -1; end if;

if (lim <= 0) then return 0; end if;

if (n > (3 ** (lim+1) - 1)/2) then return lim; end if;

if (n mod 9 = 4 or n mod 9 = 7) then

d := A125731((n-1)/3, lim-1);

d2 := A125731(2*n, d);

if (d2 < d) then d := d2; end if;

else

d := A125731(2*n, lim-1);

end if;

return 1+d;

end proc;

CROSSREFS

Sequence in context: A152656 A096162 A053383 this_sequence A123361 A107106 A119502

Adjacent sequences: A125728 A125729 A125730 this_sequence A125732 A125733 A125734

KEYWORD

sign

AUTHOR

David Applegate (david(AT)research.att.com) and N. J. A. Sloane (njas(AT)research.att.com), Feb 02 2007

page 1

Search completed in 0.002 seconds

Lookup | Welcome | Find friends | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
More pages | Superseeker | Maintained by N. J. A. Sloane (njas@research.att.com)

Last modified November 24 23:16 EST 2009. Contains 167481 sequences.


AT&T Labs Research