RosettaCodeData/Task/Esthetic-numbers/EasyLang/esthetic-numbers.easy
2026-02-01 16:33:20 -08:00

41 lines
757 B
Text

func$ to n b .
if n = 0 : return 0
while n > 0
d = n mod b
n = n div b
d += 48
if d >= 58 : d += 7
s$ = strchar d & s$
.
return s$
.
func esthetic n b .
if n = 0 : return 0
i = n mod b
n = n div b
while n > 0
j = n mod b
if abs (i - j) <> 1 : return 0
n = n div b
i = j
.
return 1
.
for b = 2 to 16
print "Base " & b & ": " & 4 * b & "th to " & 6 * b & "th esthetic numbers:"
n = 1
c = 0
while c < 6 * b
if esthetic n b = 1
c += 1
if c >= 4 * b : write to n b & " "
.
n += 1
.
print ""
print ""
.
print "Base 10 esthetic numbers between 1000 and 9999:"
for i = 1000 to 9999
if esthetic i 10 = 1 : write i & " "
.