Results 1 to 18 of 18

Collatz conjecture

Threaded View

candicee Collatz conjecture 12-24-2017, 09:15 PM
svg3414 Re: Collatz conjecture 12-24-2017, 10:08 PM
FlameRetired Re: Collatz conjecture 12-25-2017, 12:33 AM
svg3414 Re: Collatz conjecture 12-25-2017, 01:05 AM
candicee Re: Collatz conjecture 12-25-2017, 05:41 AM
bakerman2 Re: Collatz conjecture 12-25-2017, 08:35 AM
candicee Re: Collatz conjecture 12-25-2017, 10:02 AM
candicee Re: Collatz conjecture 12-25-2017, 10:15 AM
candicee Re: Collatz conjecture 12-25-2017, 09:58 AM
bakerman2 Re: Collatz conjecture 12-25-2017, 11:25 AM
candicee Re: Collatz conjecture 12-25-2017, 11:28 AM
xladept Re: Collatz conjecture 12-25-2017, 12:58 PM
candicee Re: Collatz conjecture 12-25-2017, 01:05 PM
candicee Re: Collatz conjecture 12-25-2017, 01:03 PM
xladept Re: Collatz conjecture 12-25-2017, 01:44 PM
candicee Re: Collatz conjecture 12-25-2017, 01:51 PM
xladept Re: Collatz conjecture 12-25-2017, 02:46 PM
bakerman2 Re: Collatz conjecture 12-25-2017, 05:04 PM
  1. #1
    Registered User
    Join Date
    12-24-2017
    Location
    strasbourg, France
    MS-Off Ver
    15.41 excel
    Posts
    21

    Collatz conjecture

    Hello everyone!

    The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined as follows: start with any positive integer n. Then each term is obtained from the previous term as follows: if the previous term is even, the next term is one half the previous term. Otherwise, the next term is 3 times the previous term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.

    I am trying to program something that will show me the amount of steps (of loops) that happened before the number n became smaller than the initial number.
    It is the variable dva, but I don't know how to find it!
    then I also need to show every step: every value of n (one or each loop) and
    Also the highest value that n takes throughout the loops (am)
    and the number of steps until n reaches 1 (dv)

    I have started something but I feel stuck moving forward as the beginning doesn't even work..

    can someone point me to where I'm messing up here?



    Sub collatz2()
    n = InputBox("type in a number ")
    
    am = 0
    
    Do While n <> 1
        If n Mod 2 = 0 Then
            n = n * 2
        Else: n = n * 3 = 1
        End If
    
    If n > am Then
        Z = am
    End If
    
    x = x + 1
    Dim ligne As Integer
    'Cells(1, 1).Value = "Trip"
    Cells(x, 1).Value = n
    
    Loop
    
    'Cells(1, 2).Value = "Steps"
    Cells(x, 2).Value = x
    
    'Cells(1, 3).Value = "Maximal altitude"
    Cells(x, 3).Value = am
    
    End Sub
    Last edited by candicee; 12-24-2017 at 10:00 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1