Atle's palindrome-checker V 1.02

2004.04.28

Back Download

What it does:

A palindrome is a number which is read the same backwards and forwards. To find out if it is, the number is added whit the backwards-version of itself. If it still does not seem to mirror itself on the middle, the sum is added whit itself backwards again. This operation continues until it looks OK.

This script has its own command-line interface. It has no arguments, you just start it and when you have typed your number, pressed return, and the calculation is done, you can type another number.

You may also specify a range to search trough, and also choose the interval between each number to check.

To exit if you don't want to wait for calculations to be done, press ctrl+c. Else if you are on the prompt, type bye, exit or quit (some others also possible).

Type help to get a list of options and a reminder of valid syntaxes.

Syntax:

n[-[[+]s[xi]]]

Only "n" is required, must be a positive, non-decimal and non-zero number (all numbers must be so).

If "-" is specified, range-mode is enabled. "n-" alone means from "n" to infinity.

"s" is the range end. No number larger than this is checked, but an equal one is done if the interval stops here. If a "+" is in front of "s", the range stop becomes "s" added with "n".

"xi" sets the interval. "x" is an operator, and is always the same. "i" is the interval. Default interval is 1.

"xi" can be set alone with "n-" ("n-xi") to search from "n" to infinity with interval "i".

Options:
Options are used as commands.

-l[! |logfile] | -v[!]

"-l logfile" enables logging. Replace logfile with the location, and you are prompted if it exist already. Just "-l!" disables logging.

"-v" enables verbose output, showing calculations. "-v!" disables verbose output.

"-a" prints all enabled options and their arguments.

"-s" enables non-calculation mode, only one check is done. "-s!" disables this option.

Examples:

98

Checks the number 98.

10-60

Checks 10,11,12...59,60.

100-200x2

Checks 100,102,104,106...198,200.

1-

Checks from 1 to infinite.

100-x20

Checks from 100 to infinite with interval 20.

50-+20

Checks 50-(50+20) which means 50-70.

-l /tmp/palindrome.log

Enables logging to the file "/tmp/palindrome.log".

Changes from V 1.01


Atle Solbakken

SourceForge.net Logo