How to resolve the algorithm Find palindromic numbers in both binary and ternary bases step by step in the Common Lisp programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Find palindromic numbers in both binary and ternary bases step by step in the Common Lisp programming language
Table of Contents
Problem Statement
It's permissible to assume the first two numbers and simply list them.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Find palindromic numbers in both binary and ternary bases step by step in the Common Lisp programming language
Source code in the common programming language
(defun palindromep (str)
(string-equal str (reverse str)) )
(loop
for i from 0
with results = 0
until (>= results 6)
do
(when (and (palindromep (format nil "~B" i))
(palindromep (format nil "~3R" i)) )
(format t "n:~a~:* [2]:~B~:* [3]:~3R~%" i)
(incf results) ))
You may also check:How to resolve the algorithm Continued fraction/Arithmetic/Construct from rational number step by step in the Icon programming language
You may also check:How to resolve the algorithm Repeat step by step in the Lean programming language
You may also check:How to resolve the algorithm Smallest number k such that k+2^m is composite for all m less than k step by step in the Go programming language
You may also check:How to resolve the algorithm Optional parameters step by step in the Go programming language
You may also check:How to resolve the algorithm Chinese remainder theorem step by step in the Fortran programming language