+ 1
Challenge::Find Nivenmorphic Number
AĀ Nivenmorphic numberĀ orĀ harshadmorphic numberĀ for a given number base is an integerĀ tĀ such that there exists some harshad numberĀ NĀ whoseĀ digit sumĀ isĀ t, andĀ t, written in that base, terminatesĀ NĀ written in the same base. For example, 18 is a Nivenmorphic number for base 10: 16218 is a harshad number 16218 has 18 as digit sum 18 terminates 16218
27 Answers
+ 6
Hope I understood the definition of a Nivenmorphic number, i.e. the number must be a Niven number AND its final digit(s) must be the sum of its digits.
https://code.sololearn.com/cWoxBR13k94p/?ref=app
+ 2
Ok I have to amend the code to check if the sum is also a Niven number. (edit. fixed now)
+ 1
ok..
its for harshad number checking..
one line code
detailed code
https://code.sololearn.com/cwiDW62WGpVw/?ref=app
https://code.sololearn.com/cNu568lDNhWp/?ref=app
+ 1
16218 is a Niven number: sum of its digit is 18 and 18 is Niven
16218 terminates with 18
So, 16218 is Nivenmorphic or Harshadmorphic
+ 1
This code finds least Harshad number of a base (hopefully Nivenmorphic) integer
https://code.sololearn.com/cKKHUiVRw2R4/?ref=app
0
@Sayan In that way, a whole complex program can be made in one line
0
@Kartikey not in python
0
@Supersebi3 You can create in any language
0
@sayan your code doesnt seem quite right
0
@Kartikey as python uses forced indentation, it is not possible to write code that comes after if statements, loops or similar in the same line as themselves
0
@Supersebi3 The topic here is not if you can write a while program in one line and my previous answer was not for python
0
@Kartikey you answered to me, and i was talking about the indentation...
Anyways, i dont quite get the challenge, what exactly is a harshad number?
0
@sayan it looks like it doesnt check if the number terminates the other number, it just checks if the number is in the other number
0
Also, both codes dont check for a nivenmorphic number, but for a harshad number... Both say false if i input 18
0
According to the above definition, that makes 18 not a harshad number, but not not a nivenmorphic number
0
Also, the bases are important apparently
0
True...
0
Maybe theres more to harshad numbers
0
@Kartikey answer
0
Ew whatsapp
Use discord