MathBabbler started doing a good amount of BABbling about numbers, so during March of 2008 he began writing C++ (and C) programs to help analyze numbers. This collection of programs evolved into the MBNA (MathBabbler Number Analyst).

Some of the MBNA programs were written during lectures at Scottsdale Community College and many of them have been used as instructional material.

- ProperDivisors [created 7 March 2008]

Prints proper divisors of n; prints a count of proper divisors; prints if n isdeficient, proper, abundant; prints abundance ratio.- Fibonacci [created 27 March 2008] Prints if n is a
Fibonaccinumber.- HappyUnhappy [created 8 March 2008] Prints if n is a
HappyorUnhappynumber.- Harshad [created 7 March 2008] Prints if n is a
Harshadnumber.- PrimeComposite [created 10 March 2008]

Prints if n isprimeorcomposite. If n is prime, printscousinprimes if any; printssafeprimes if any; printssexyprimes if any; printssexy tripletprimes if any; printssexy quadrupleprimes if any; printsSophie Germainprimes if any; printsTruman Geraldprimes if any; prints if n isPythagoreanprime; prints if n isEisensteinprime; prints if n isGaussianprime; prints if n isstarprime; prints if n isreversibleprime; prints if n issuperprime; prints if n isleft-truncableprime; prints if n isright-truncableprime.- Undulating [created 25 March 2008] Prints if n is an
undulatingnumber.- NearestSquareNumbers [created 20 March 2008] If n not square, prints nearest square numbers < and > n.
- NumberSystems [created 09 March 2008] Prints n in base-2, base-8, base-16. Prints if n in base-2 is
evilorodious. Prints if n in base-2 ispalindromic.- PrimeFactors [created 09 March 2008]

If n is composite, prints prime factors of n and their sums; prints if n issemi-primeorsphenic; prints if n is ajoke (Smith)number; prints if n is ahoaxnumber.- SqrtLnLog [created 09 March 2008] Prints sqrt(n), ln(n), log(n).
- PrimeTripletsQuadruplets [created 03 April 2008] If n is prime, prints
prime tripletsif any; printsprime quadrupletsif any.- PerfectRoots [created 14 April 2008] Prints the perfect roots of n if any.
- Padovan [created 16 December 2008] Prints if n is a
Padovannumber.- RomanNumeral [created 22 December 2008] If n < 4000, prints n as a Romal Numeral
- ApocalypticPower [created 12 January 2009] Prints if n is an
apocalyptic power.- Pronic [created 30 January 2009] Prints if n is a
pronicnumber.- Thabit [created 12 March 2009] Prints if n is a
Thabitnumber.- Palindrome [created 31 March 2009] Prints if n is
palindromic.- RuthAaronPairs [created 31 March 2009] Prints if n is in a
Ruth-Aaron pair.- Lucky [created 02 May 2009] Prints if n is a
luckynumber.- SumOfCubes [created 09 May 2009] Prints if n is the sum of three distinct cubes.
- BaseNequivalents [created 10 June 2009] Prints n in other number systems.
- RepeatingDigit [created 16 June 2009] Prints if all digits of n are the same.
- Narcissistic [created 09 July 2009] Prints if n is a
narcissisticnumber.- ThurmNumber [created 20 July 2009] Prints if floor(n/20) and n%20 are primes.
- Zuckerman [created 01 August 2009] Prints if n is a
Zuckermannumber.- Triangular [created 08 October 2009] Prints if n is a
triangularnumber.- Leyland [created 15 October 2009] Prints if n is a
Leylandnumber.- format [created 15 October 2009] Program used to create nBAB collections.
mbna_program | format- ConsecutivePrimes [created 24 November 2009] If n is the sum of two or more consecutive primes, the consecutive primes are printed.
- Lucas [created 19 December 2009] Prints if n is a
Lucasnumber.- SquareDiffs [created 06 February 2010]

Finds the x value for an odd number input n that satisfies (x+1)^2-x^2 and (x+1)+x. It also finds the x value for an even number input n that is a multiple of 4 that satisfies (x+1)^2-(x-1)^2 and 2(x+1 + x-1)- Pentagonal [created 12 March 2010] Prints if n is a
pentagonalnumber.- SquareFree [created 06 December 2011] Prints if n has or doesn't have square number divisors.
- Kaprekar Number [created 01 June 2012] Prints if n is a
Kaprekarnumber.- SumOfCubes [created 13 August 2012] Prints if n is the sum of three distinct cubes.
- Octahedral [created 25 February 2013] Prints if n is an
octahedralnumber.- Dodecagonal [created 23 April 2013] Prints if n is a
dodecagonalorcentered dodecagonalnumber.- Powerful [created 30 November 2013] Prints if n is a
powerfulnumber.- A117746 [created 20 February 2014] Prints if n is in OEIS integer sequence
A117746.- Mersenne [created 26 March 2014] Prints if n is a
Mersennenumber.- Harmonic [created 28 April 2014] http://oeis.org/A001599
- A038853 [created 08 May 2014] Prints n if its divisible by 5 and is the difference between two (different positive) cubes.
- X in X [created 04 July 2014] Prints the proper divisors of n that are in the decimal representation of n.
- Arithmetic [created 31 December 2014] Prints n if it is an
Arithmeticnumber.- Nude [created 16 May 2015] Prints n if it is an
Nudenumber. n is Nude if the digits of n are factors of n.- Lychrel [created 30 August 2015] Prints if n is a potential
Lychrelnumber.- Moran [created 30 March 2016] Prints if n is a
Morannumber.## Deprecated

- EvilOdious [created 4 March 2008] Prints if n in base-2 is
evilorodious. Functionality now in NumberSystems.- EisensteinPrime [created 07 April 2009] Prints if n is an
Eisensteinprime. Functionality now in PrimeComposite.## Number Notes

- apocalyptic power
- An
apocalyptic poweris a number n such that 2^n contains 666.

- arithmetic
- The number n is an
Arithmeticnumber if the average of its divisors is an integer.

- centered & non-centered dodecagonal
- A
dodecagonalis a number that is generated by the expression 5n^2-4n. Acentered dodecagonalis a number generated by the expression 6n^2+6n+1.

- deficient or perfect or abundant
- Sum the proper divisors for a number. If the sum equals the number, then the number is
perfect. If the sum is less than the number, then the number isdeficient; otherwise, the number isabundant.

- Eisenstein prime
- An
Eisenstein primeadheres to the form: 3n-1, where n is an integer.

- evil or odious
- A number is
evilif its binary representation has an even number of 1's; otherwise, the number isodious.

- Fibonacci
- A number is a
Fibonaccinumber if it is in the Fibonacci sequence of numbers (0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, ...).

- Friedman
- OEIS.org::A083509 "Friedman numbers: can be written in a nontrivial way using their digits and the operations + - * / ^ and concatenation of digits (but not of results)." Smallest Friedman number is 25 (5^2) followed by 121 (11^2), 125 (5^(1+2)), 126 (21*6), 127 (2^7-1), 128 (2^(8-1), 153 (3*51), and so on. {Stetson.edu::MathMagic Friedman number}

- Gaussian Prime
- OEIS.org::A002145 A
Gaussianprime is of the form4n + 3.

- happy or unhappy
- A number is
happyif iterating through the sum of the squares of the digits of the number eventually evaluates to one. Anunhappynumber is a number that's not happy.

- Harshad
- OEIS.org::A005349 A number is a
Harshad(orNiven) number if the sum of its digits is a factor (i.e. proper divisor) of the number.

- hoax
- From MathWorld.Wolfram.com: A
hoaxnumber is a "composite number defined analogously to a Smith number except that the sum of the number's digits equals the sum of the digits of its distinct prime factors (excluding 1)."

- Kaprekar
- A number 'n' is a
Kaprekarnumber if when squared its product has an even number of digits and the sum of the numbers that result from splitting the product is the number 'n'.

- Leyland
Leylandnumbers are of the form x^y+y^x.

- Lucas
- A number is a
Lucasnumber if it is in the Lucas sequence of numbers (2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123, 199, 322, 521,...)

- Lucky
Luckynumbers are produced from a sieve that adheres to the following algorithm: Start with the natural numbers. Delete every 2nd number, leaving 1 3 5 7 ...; the 2nd number remaining is 3, so delete every 3rd number, leaving 1 3 7 9 13 15 ...; now delete every 7th number, leaving 1 3 7 9 13 ...; now delete every 9th number; etc. [source: OEIS.org]

- Lychrel
- OEIS.org: "Positive integers which apparently never result in a palindrome under repeated applications of the function
f(x) = x + (x with digits reversed)."

- Moran
- A number is a
Morannumber if it results in a prime number when divided-by the sum of its digits.

- Narcissistic
- OEIS.org: A number is
narcissisticif "n-digit numbers equal to sum of n-th powers of their digits." (1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474, 54748, 92727...).

- Octahedral
Octahedralnumbers are the sequence of integers generated by the expression`.`

(2*n^3+n)/3

- Odd Square (Centered Octagonal Numbers)
Odd Squaresare odd numbers that are also square numbers. The Odd Squares integer sequence is generated by the expression`. Odd Square checking added to the MBNA on 16 December 2013.`

(2n+1)^2

- Padovan
- A number is a
Padovannumber if it is in the Padovan sequence of numbers (1, 1, 1, 2, 2, 3, 4, 5, 7, 9, 12, 16, 21, 28, 37, 49, 65, 86, 114, 151, 200, 265...).

- palindromic
- A number is
palindromicif reversing the digits equals the original number. 101 is palindromic and so is 12021.

- pentagonal
- A number 'n' is
pentagonalif (sqrt(24n+1)+1)/6 evalutes to an integer.

- powerful
Powerfulnumbers are generated using the formulaa, where^{2}b^{3}a ≥ 1andb ≥ 1.

- prime triplet
- A
prime tripletis a set of three prime numbers of the form {p, p+2, p+6} or {p, p+4, p+6}.

- prime quadruplet
- A
prime quadrupletis four prime numbers of the form {p, p+2, p+6, p+8}.

- pronic number
- A
pronic (oblong)number is a number which is the product of two consecutive integers, that is, n (n + 1).

- repdigit number
- A
repdigitnumber (in a particular base) is a number consisting of all the same digits (e.g. 11, 777, 4444...).

- Ruth-Aaron pair
- A
Ruth-Aaronpair consists of two consecutive integers for which the sums of the prime factors of each integer are equal.

- safe prime pair
- OEIS.org: "
Safeprimes p: (p-1)/2 is also prime."

- sexy prime pair
- A
sexyprime pair are two prime numbers that differ by six.

- Smith number
- A number is a
Smithnumber if the sum of its digits equals the sum of the digits of its prime factors.

- Squarefree number
- A number is a
Squarefreenumber if it is not evenly divisable by a square number n such that n ≥ 4.

- sum-product number
- A number is a
sum-productnumber if the sum of its digits times the product of its digits equals the number.

- super prime
- A number is a
super primeif it is prime number and if it resides in a prime numbered slot given a list of prime numbers. The first super prime is 3 (it is the 2nd prime number and 2 is prime), the second super prime is 5 (it is 3rd prime number). 7 is not a super prime because it is the 4th prime number and 4 is not prime).

- Thabit number
- A
Thabitnumber is in the sequence generated by 3 * 2^n - 1, where 0 <= n < infinity.

- ThurmNumber
- A
ThurmNumberis a number that has a prime score and prime plus number when represented in score plus number format.

- triangular
- The nth
triangularnumber is generated by by formula`.`

n(n+1)/2

- undulating
- A number is
undulatingif it has an 'aba...' pattern. The numbers 1-99 are trivial undulating numbers. The first non-trivial undulating number is 101.

- Zuckerman
- A
Zuckermanis a number that has a proper divisor that is the product of its digits.## Internals

The MBNA programs can be executed either as stand-alone programs or as a part of other applications. The

mbnaprogram itself is a shell script that executes the collection of MBNA programs.MBNA programs get their inputs via command-line arguments. Some of the programs get their inputs interactively if no command-line argument is specified.

When applicable, the source code for the MBNA programs contain hyperlinks into the OEIS (Online Encyclopedia of Integer Sequences).

Most of the MBNA programs can be executed to generate a list of the first few numbers of their type (i.e. Fibanocci, Padovan, powerful, lucky, etc.).

The MBNA checks for

Friedmannumbers, but does so using a table lookup instead of computation.## Needed Modifications

Multiple MBNA programs check numbers for primeness; however, each source file contains its own implementation of an

isprime(n)function. This function needs to be made into a library function that is linked into each program that uses it, or it should be defined as a macro that is placed into a local header file and compiled into the program.

**Creator:** Gerald Thurman
[gthurman@gmail.com]

**Created:** 18 April 2008

This work is licensed under a Creative Commons Attribution 3.0 United States License.