Skip to content

Latest commit

 

History

History
23 lines (21 loc) · 581 Bytes

File metadata and controls

23 lines (21 loc) · 581 Bytes

PL-SQL-lab-test

Write a PL/SQL code to print the frequency of numbers between 1 and 1000 such that the recursive sum of squares of digits of a number converges cyclically to a one-digit number. (15/20)

Example -

1 -> 1 -> 1 (so on)
2 -> 4 -> 16 -> 37 -> 58 -> 89 -> 145 -> 42 -> 20 -> 4 (cyclical convergence to 4)
3 -> 9 -> 81 -> 65 -> 61 -> 37 -> 58 -> 89 -> 145 -> 42 -> 20 -> 4 (cyclical convergence to 4) 

Answer - For 1 to 3, frequency table is

Number Frequency 
0       0 
1       1
2       0
3       0
4       2
5       0
6       0
7       0