Skip to content

This repository serves as a solution submission platform for the participants of HOC 2018 at Perennial Systems.

Notifications You must be signed in to change notification settings

varsha123/hoc18

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Participate in the Hour Of Code

Hour of Code 2018

Solve the following questions:

1.

Write a program that prints all the prime numbers between ‘x’ and ‘y’, inclusive of ‘x’ and ‘y’ without using a loop where ‘x’ and ‘y’ will be specified by the user.

2.

Write a program to decode a string of messages made up of seemingly random characters and of variable lengths. For example:

“aWk60#ase2> o_0^4alis5L”

To decode this string, you simply add the numbers in each block. A block is a continuous string without a space:

aWk60#ase2> → 6 + 0 + 2 = 8 o_0^4alis5L → 0 + 4 + 5 = 9

Each number corresponds to a letter of the alphabet such that: 0 = ‘’ 1 = ‘a’ 2 = ‘b’

and so on. Thus, 8 9 → ‘hi’ If sum of digits goes over 26, loop back to zero. Thus,

“aWk60#ase2> o_2^293alis874L” → 6+0+2=8, 2+2+9+3+8+7+4=35 → 8, 9 → “hi”


3.

Any natural number is called as a z-prime if it has exactly z prime factors.

For ex: z = 2 → 4 (2,2), 6 (2,3), 9 (3,3), 10 (2,5) z = 3 → 8, 12, 18, 20 z = 5 → 32, 48, 72, 80

a. Write a function findZprimes which accepts parameters k, start and end and returns an array or list or slice depending on the language of the k-primes between and inclusive of ‘start’ and ‘end’.

b. Write a function findZprimeAddends which accepts a number ‘n’ and returns an array of all possible 3 numbers ‘p’, ‘q’ and ‘r’ such that: p is 1-prime q is 3-prime r is 7-prime p + q + r = n


Bonus Question

4.

Write a Program with two functions to encode and decode to and from Base64 respectively. Do not use in built functions for base64 directly. Read more about base64 here.

About

This repository serves as a solution submission platform for the participants of HOC 2018 at Perennial Systems.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published