CrazyEngineers
  • base-n series generator for a given number

    ms_cs

    ms_cs

    @ms-cs-Ab8svl
    Updated: Oct 13, 2024
    Views: 1.0K
    for example if my input is 2,then series shuould be, 00,01,10,11,etc.,
    if my input is 10,then series shuould be,1,2,3,4,5,etc.,

    is there any general mechanism in mathematics to find these numbers so that I can program for that
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Saandeep Sreerambatla

    MemberJun 2, 2010

    In base 2 system using only 2 numbers you can get the maximum number as 3 which is 11.
    So my basic idea is ...
    using 4 digits as the number you can get the maximum number as 2[sup]4[/sup] - 1 = 15 using 4 numbers!

    Lets take 2 numbers only here..
    thus with base 2 system you can give numbers upto 2[sup]2[/sup] -1 = 3
    So the numbers are 00 , 01, 10, 11

    In base 3 system the maximum number we can represent is (22)[sub]3[/sub]
    thus the number is 3[sup]2[/sup]-1 = 8
    And this holds good for all the bases thus you can design a program which takes 2 inputs, the base and the number of digits which represent a number. By that you can design it.

    I hope you know how to convert numbers to any base system ?
    Are you sure? This action cannot be undone.
    Cancel
  • silverscorpion

    MemberJun 4, 2010

    If input is 2 you want 00,01,10 and 11 which are binary.
    If input is 10, you want 1,2,3 which is in decimal system.

    I'm confused.. Please clarify..
    Are you sure? This action cannot be undone.
    Cancel
  • Morningdot Hablu

    MemberJun 4, 2010

    hey what you want to do.
    when input is decimal then output is binary series.
    and when input is binary output is decimal series.
    can you clearify your question.
    Are you sure? This action cannot be undone.
    Cancel
  • Saandeep Sreerambatla

    MemberJun 6, 2010

    silverscorpion
    If input is 2 you want 00,01,10 and 11 which are binary.
    If input is 10, you want 1,2,3 which is in decimal system.

    I'm confused.. Please clarify..

    @SS: As far as I understood , donot go with Decimal or binary naming conventions, the question is to get the numbers of the given base , infact the base -2 system is called Binary but that name is nothing to do with it!
    Since Decimal is called base -10 system , the question is to find the representation of numbers in given base.
    Are you sure? This action cannot be undone.
    Cancel
  • Manish Goyal

    MemberJun 7, 2010

    why don't you use basic method of converting a no to any other base system

    ie by dividing no by n picking up remainder
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register