NUMBER PROBLEMS ?
1. write a program to generate and print the following complex series.
1, 3, 6, 10, 15, 21 .... N terms
2, 4, 12, 48,...... N terms
2, 2, 3, 5, 8, 12, 17 .... N terms
1,1,2,6,24,120, .... N terms
1, 2, 8, 64, ... N terms

ANSWER...

2. write a program to print the following series.
1, 2, 3, 4, 5, 6, 7, 8 ..... N terms
2, 4, 6, 8, 10, 12, ......... N terms
1, 3, 5, 7, 9, 11, 13, 15 .... N terms
4,8,12,16,20, 24, 28, 32, ..... N terms
2, 4, 5, 16, 32, 64, 128, 256.... N terms
5, 10, 15, 20, 25, 30, .... N terms


ANSWER...

3. Write a Java program to check whether a number is a Harshad Number or not.
In recreational mathematics, a harshad number in a given number base, is an integer that is divisible by the sum of its digits when written in that base.
Example: Number 200 is a Harshad Number because the sum of digits 2 and 0 and 0 is 2(2+0+0) and 200 is divisible by 2. Number 171 is a Harshad Number because the sum of digits 1 and 7 and 1 is 9(1+7+1) and 171 is divisible by 9.

ANSWER...

4. write a program to read a number and print all of its digits separately.

ANSWER...

5. write a program to read a number and remove odd digits from the number.

ANSWER...

6. write a program to print the following series
1, -2, 3, -4, 5, -6, 7, -8, 9, -10, . . . . N terms

ANSWER...

7. write a program to read a number and find out the number is perfect number or not.
[A number is said to be perfect number when sum of all its factors is equal to the number
example : number 6,
The factors sum is 1 + 2 + 3 = 6,
so 6 is a perfect number. ]

ANSWER...

8. Write a Java program that categorizes integers between 1 and 10,000 as Abundant, Deficient, and Perfect.
In number theory, an abundant number is a number for which the sum of its proper divisors is greater than the number itself.
Example :
The first few abundant numbers are:
12, 18, 20, 24, 30, 36, 40, 42, 48, 54, 56, 60, 66, 70, 72, 78, 80, 84, 88, 90, 96, 100, 102,…
The integer 12 is the first abundant number. Its proper divisors are 1, 2, 3, 4 and 6 for a total of 16.
Deficient number: In number theory, a deficient number is a number n for which the sum of divisors σ(n)<2n, or, equivalently, the sum of proper divisors (or aliquot sum) s(n) less than n. The value 2n − σ(n) (or n − s(n)) is called the numbers deficiency.
As an example, divisors of 21 are 1, 3 and 7, and their sum is 11. Because 11 is less than 21, the number 21 is deficient. Its deficiency is 2 × 21 − 32 = 10.
The first few deficient numbers are:
1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 21, 22, 23, 25, 26, 27, 29, 31, 32, 33, …….
Perfect number: In number system, a perfect number is a positive integer that is equal to the sum of its proper positive divisors, that is, the sum of its positive divisors excluding the number itself.
Equivalently, a perfect number is a number that is half the sum of all of its positive divisors (including itself) i.e. σ1(n) = 2n.

ANSWER...

9. write a program to find the reverse number of input number.

ANSWER...

10.

ANSWER...

11. write a program to read a number and print greatest digit of a number.

ANSWER...

12. Write a Java program to check whether a number is a Harshad Number or not.
In recreational mathematics, a harshad number in a given number base, is an integer that is divisible by the sum of its digits when written in that base.
Example: Number 200 is a Harshad Number because the sum of digits 2 and 0 and 0 is 2(2+0+0) and 200 is divisible by 2. Number 171 is a Harshad Number because the sum of digits 1 and 7 and 1 is 9(1+7+1) and 171 is divisible by 9.

ANSWER...

13. A Goldbachnumber is a positive even integer that can be expressed as the sum of two oddprimes.

Note: All even integer numbers greater than 4 are Goldbach numbers.

Example: 6 = 3 + 3
10 = 3 + 7
10 = 5 + 5

Hence, 6 has one odd prime pair 3 and 3. Similarly, 10 has two odd prime pairs, i.e., 3 and 7, 5 and 5.
Write a program to accept an even integer ‘N’ where N > 9 and N < 50. Find all the odd prime pairs whose sum is equal to the number ‘N’.
Test your program with the following data and some random data:

Example 1:
INPUT: N = 14
OUTPUT: PRIME PAIRS ARE: 3, 11
7, 7

Example 2:
INPUT: N = 30
OUTPUT: PRIME PAIRS ARE: 7, 23
11, 19
13, 17

Example 3:
INPUT: N = 17
OUTPUT: INVALID INPUT. NUMBER IS ODD.

Example 4:
INPUT: N = 126
OUTPUT: INVALID INPUT. NUMBER OUT OF RANGE.

ANSWER...

14. write a program to read a number and find out the digits are in decreasing order or not.

ANSWER...

15. Write a Java program to generate and show all Kaprekar numbers less than 1000.
Expected Output :

1 1 0 + 1
9 81 8 + 1
45 2025 20 + 25
55 3025 30 + 25
99 9801 98 + 01
297 88209 88 + 209
703 494209 494 + 209
999 998001 998 + 001
8 Kaprekar numbers.

ANSWER...

16. write a program to read a number and count the number of odd digits present in a number.

ANSWER...

17. write a program to read an increasing digits number and insert digit(x) in a number at its appropriate place.

ANSWER...

18. Write a Java program to check whether a number is an automorphic number or not.
In mathematics, an automorphic number is a number whose square "ends" in the same digits as the number itself. For example, 52 = 25, 62 = 36, 762 = 5776, and 8906252 = 793212890625, so 5, 6, 76 and 890625 are all automorphic numbers.

ANSWER...

19. Write a program to print all even numbers up to N.

ANSWER...

20. write a program to read a number and print only odd digits of a number.

ANSWER...

21. write a program to print the following series
0, 1, 1, 2, 3, 5, 8, 13, 21, .... N terms

ANSWER...

22. write a program to read an input decimal number and exchange its integer, fractional portions.

ANSWER...

23. write a program to print the following series
1/1, 2/2, 4/3, 8/4, 16/5, 32/6, 64/7 . . . . N terms

ANSWER...

24. write a program to print multiplication table for numbers 2 to N. Each table must be in multiplication table format up to 12 lines.

ANSWER...

25. write a program to read two numbers A and B and find out the numbers A and B are equal or not. The equality is done on the basis of digits presence irrespective of its digit position.
For example 3258 and 8235 are equal.

ANSWER...

26. write a program to print multiplication table of N up to 20 lines
1 x N = N
2 x N = ...
3 x 4 - ...
....
...

ANSWER...

27. write a program to print all 5 multiples upto 100
example 5, 10, 15, 20, 25, ..... 100

ANSWER...

28. Write a Java program to generate and show all Kaprekar numbers less than 1000.
Expected Output :

1 1 0 + 1
9 81 8 + 1
45 2025 20 + 25
55 3025 30 + 25
99 9801 98 + 01
297 88209 88 + 209
703 494209 494 + 209
999 998001 998 + 001
8 Kaprekar numbers.

ANSWER...

29. write a program to read a number and print all of its factors of a number.

ANSWER...

30. write a program to read a number and find out the number is armstrong number or not.
[A number is said to be armstrong number (or narcissistic number) is a number that is equal to the sum of its own digits, each raised to the power of the total number of digits in the number
example : number 153,
The sum of digits square 1^3 + 5^3 + 3^3 = 153
so 153 is an armstrong number.

ANSWER...

31. write a program to read a number and print its smallest digit.

ANSWER...

32. write a program to read two numbers A and B and print its Highest Common Factor(HCF).

ANSWER...

33. Write a program to check whether a given number is a Disarium number or an unhappy number.
A Disarium number is a number defined by the following process :
Sum of its digits powered with their respective position is equal to the original number.
For example 175 is a Disarium number :
As 11+32+53 = 135
Some other DISARIUM are 89, 175, 518 etc.
A number will be called Disarium if the sum of its digits powered with their respective position is equal with the number itself. Sample Input: 135.

Expected Output

Input a number : 25
Not a Disarium Number.

ANSWER...

34. write a program to print the following series
x^1, x^2, x^4, x^8, x^16, x^32, x^64 . . . . N terms

ANSWER...

35. write a program to print the following series
1, 2, 6, 24, 120, . . . . N terms

ANSWER...

36. write a program to read a number and print event digits of a number.

ANSWER...

37. Write a Java program to check two numbers are Amicable numbers or not.
Amicable numbers are two different numbers so related that the sum of the proper divisors of each is equal to the other number.
The first ten amicable pairs are: (220, 284), (1184, 1210), (2620, 2924), (5020, 5564), (6232, 6368), (10744, 10856), (12285, 14595), (17296, 18416), (63020, 76084), and (66928, 66992).
Expected Output

Input the first number: 220
Input the second number: 284
These numbers are amicable.

ANSWER...

38.

ANSWER...

39. write a program to read a number and remove duplicate digits from the number.

ANSWER...

40. write a program to read a number and find the sum of its factors.

ANSWER...

41. write a program to read a number and search and print the duplicate digit present in a number.

ANSWER...

42. write a program to read a number and search the 0 digit present in a number or not. If present print 'ZERO is Present in a NUMBER'.

ANSWER...

43. write a program to print the following series
1, 2, 4, 7, 11, 15, 20 . . . . N terms

ANSWER...

44. write a program to read a number and remove even digits from the number.

ANSWER...

45. Write a program to read two numbers A, B and print its LCM.

ANSWER...

46. write a program to read a number and count the number of even digits present in a number.

ANSWER...

47. write a program to find the sum of all the terms of following series.
1, 2, 3, 4, 5, 6, 7, 8 ..... N terms
2, 4, 6, 8, 10, 12, ......... N terms
1, 3, 5, 7, 9, 11, 13, 15 .... N terms
4,8,12,16,20, 24, 28, 32, ..... N terms
2, 4, 5, 16, 32, 64, 128, 256.... N terms
5, 10, 15, 20, 25, 30, .... N terms


ANSWER...

48. write a program to read a number and prints its prime factors.

ANSWER...

49. Write a Java program to check whether a number is a Duck Number or not.
Note: A Duck number is a number which has zeroes present in it, but there should be no zero present in the beginning of the number. For example 3210, 7056, 8430709 are all duck numbers whereas 08237, 04309 are not.

ANSWER...

50. write a program to print the following series
1, 2, 4, 8, 16, 32, 64 . . . . N terms

ANSWER...

51.

ANSWER...

52. Write a Java program to check whether a given number is a Disarium number or an unhappy number.
A Disarium number is a number defined by the following process :
Sum of its digits powered with their respective position is equal to the original number.
For example 175 is a Disarium number :
As 11+32+53 = 135
Some other DISARIUM are 89, 175, 518 etc.
A number will be called Disarium if the sum of its digits powered with their respective position is equal with the number itself. Sample Input: 135.

ANSWER...

53. Write a program to read a number and find out the numberis Keith Number or not.
For example, 197 is a keith number because its digits (1, 9, 7) creates the sequence 1,9,7,17,33,57,107,197, in which number is part of it.


ANSWER...

54. Write a Java program to check two numbers are Amicable numbers or not.
Amicable numbers are two different numbers so related that the sum of the proper divisors of each is equal to the other number.
The first ten amicable pairs are: (220, 284), (1184, 1210), (2620, 2924), (5020, 5564), (6232, 6368), (10744, 10856), (12285, 14595), (17296, 18416), (63020, 76084), and (66928, 66992).

ANSWER...

55. A distinct-prime-digit integer is a positive integer (without leading zeros) in which all digits are prime numbers and no digit is repeated. The prime digits are 2, 3, 5, 7.
For example 2, 37, 253 are distinct-prime-digit integers, where as 33, 252, 29 are not.

Given two positive integers m and n, where m<n, write a program to determine how many distinct-prime-digit integers are there in the range between m and n ( both inclusive) and output them.

ANSWER...

56. Write a Java program to check if a given number is a circular prime or not.
Circular Prime : A circular prime is a prime number with the property that the number generated at each intermediate step when cyclically permuting its (base 10) digits will be prime.
For example, 1193 is a circular prime, since 1931, 9311 and 3119 all are also prime.

ANSWER...

57. Write a Java program to check whether a number is a Pronic or Heteromecic Number or not.
A pronic number is a number which is the product of two consecutive integers, that is, a number of the form n(n + 1).
The first few pronic numbers are:
0, 2, 6, 12, 20, 30, 42, 56, 72, 90, 110, 132, 156, 182, 210, 240, 272, 306, 342, 380, 420, 462 … etc.

Expected Output
Input a number : 110
Pronic Number.

ANSWER...

58. Write a Java program to check whether a given number is ugly.
In number system, ugly numbers are positive numbers whose only prime factors are 2, 3 or 5. First 10 ugly numbers are 1, 2, 3, 4, 5, 6, 8, 9, 10, 12. By convention, 1 is included.
Test Date:Input an integer number: 235

ANSWER...

59. Write a Java program to check if a number is a cube or not.
In arithmetic and algebra, the cube of a number n is its third power: the result of the number multiplied by itself twice:
n3 = n × n × n.
Input Data:
Input a number: 8
Expected Output

Number is a cube.

ANSWER...

60. write a program to read a number and count the number of digits present in a number.

ANSWER...

61. Write a Java program to find any number between 1 and n that can be expressed as the sum of two cubes in two (or more) different ways.
Here are some examples of Ramanujan numbers :
1729 = 1^3 + 12^3 = 9^3 + 10^3
1729 = 1^3 + 12^3 = 9^3 + 10^3
4104 = 2^3 + 16^3 = 9^3 + 15^3
1729 = 1^3 + 12^3 = 9^3 + 10^3
4104 = 2^3 + 16^3 = 9^3 + 15^3
13832 = 2^3 + 24^3 = 18^3 + 20^3
39312 = 2^3 + 34^3 = 15^3 + 33^3
46683 = 3^3 + 36^3 = 27^3 + 30^3
32832 = 4^3 + 32^3 = 18^3 + 30^3
40033 = 9^3 + 34^3 = 16^3 + 33^3
20683 = 10^3 + 27^3 = 19^3 + 24^3
65728 = 12^3 + 40^3 = 31^3 + 33^3
64232 = 17^3 + 39^3 = 26^3 + 36^3

ANSWER...

62. Given two positive numbers M and N, such that M is between 100 and 10000 and N is less than 100. Find the smallest integer that is greater than M and whose digits add up to N. For example, if M = 100 and N = 11, then the smallest integer greater than 100 whose digits add up to 11 is 119.

Write a program to accept the numbers M and N from the user and print the smallest required number whose sum of all its digits is equal to N. Also, print the total number of digits present in the required number. The program should check for the validity of the inputs and display an appropriate message for an invalid input.

Test your program with the sample data and some random data:

Example 1

INPUT : M = 100 N = 11

OUTPUT : The required number = 119
Total number of digits = 3
Example 2

INPUT :M = 1500N = 25

OUTPUT :The required number = 1699
Total number of digits = 4

Example 3

INPUT : M = 99 N = 11

OUTPUT : INVALID INPUT

ANSWER...

63. Write a Java program to check if a number is a palindrome or not.
In number system a palindromic number is a number that is the same when written forwards or backwards, i.e., of the form .
The first few palindromic numbers are therefore are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111, …

ANSWER...

64. write a program to read a number and find out the digits are in increasing order or not?.

ANSWER...

65. Write a Java program to find and print the first 10 happy numbers.
Happy number: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1, or it loops endlessly in a cycle which does not include 1.
Example: 19 is a happy number
1^2 + 9^2=82
8^2 + 2^2=68
6^2 + 8^2=100
1^2 + 0^2 + 0^2=1

ANSWER...

66. Write a Java program to check whether a number is a Pronic or Heteromecic Number or not.
A pronic number is a number which is the product of two consecutive integers, that is, a number of the form n(n + 1).
The first few pronic numbers are:
0, 2, 6, 12, 20, 30, 42, 56, 72, 90, 110, 132, 156, 182, 210, 240, 272, 306, 342, 380, 420, 462 … etc.

ANSWER...

67. Write a program to print all natural numbers upto N.
ex. 1, 2, 3, 4, 5, .... N

ANSWER...

68. A digit permutation cipher is a simple for of number encryption where the digits of a number are rearrangedd based on a given key where (1<=key<=size of the number). The key is a sequence of integers that defines the new positions of the digits.
Example : If number = 2613 and key =4213, then the encrypted number will be 1632 by positioning the first digits to the 4th place, second digit to the second place, theird digit to the first place and the fourth digit to the third place as per the key given.

Write a program to enter a number and a permutation key ( a sequence of digits which is greater than 0 and less than or equal to the size of the number). The program should encrypt the number by permuting its digits according to the key. The number of digits in the key must match the number of digits in the number to be encrypted.

ANSWER...

Hungry Minds


HUNGRY MINDS
REG.NO. 09AKEPV9632M2Z9
Regd. Office : 120, Khirighat, Basti - 272002,
Uttar Pradesh , India.

Branch Office : No 91, Vallalar Nagar, V.M. Chatiram,
Tirunelveli - 627011, India

Our Services

School Software

Payment Gateway

Church Management Software

Mobile Apps

Ecommerce Site Development

Robotics Classes



hungryminds.basti@gmail.com

vasantharaj1972@gmail.com

- 2024 Copyright is Reserved. Hungry Minds 7778, India - 7985872766.