Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

1. ## Bleak number

—>Bleak Numbers
In Mathematics each number has one special number, which it supports, chosen as follows. It counts the number of ones in its own binary representation, and adds this count to itself to obtain the value of the number it supports. That is, if j(m) means the number of ones in the binary representation of m, then m supports m+j(m). For example, the number eight (1000 in binary) supports nine, whereas nine supports eleven.
However, in this way not all the numbers get supported; some are left without support, and we call these numbers bleak. For example since one supports two, two supports three and three supports five, there is no number less than four, which would support four, so four is bleak.

Your task is for a given number recognize if it is bleak or supported by some number.

Input

First integer containing the number of test cases, followed by the number to be checked.

Output

For every checked number n write one line containing the word BLEAK if n is bleak or the word SUPPORTED if given n there exists m such that n=m+j(m). In case of wrong input print -999

2. ## Re: Bleak number

Do you have a question?

3. ## Re: Bleak number

Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

4. ## Re: Bleak number

i want help in making the program on bleak numbers. Can you help me by giving the code or the logic ??

5. ## Re: Bleak number

We dont give you code, but we will help you write it by yourself.
Its best if you show us what you have gotten so far, and write down your thought process and what you have planned. We can then commentate on your code and guide you in the right direction.

6. ## Re: Bleak number

As a small hint - learn about binary notation and how binary is expressed.
i.e: each binary digit is either a 1 or a zero - they can be translated into digits
or characters. But agreed with above - we need to see working code from you
before we can help further.