Showing posts with label self number. Show all posts
Showing posts with label self number. Show all posts

Thursday, 25 October 2018

Self Numbers and Junction Numbers

Today I turned 25407 days old and discovered from Numbers Aplenty that it is a self number or Columbian number. Such a number is defined as one that cannot be written as \(x+\mathrm{sod}(x) \) where \(\mathrm{sod}(\cdot) \) denotes the sum of digits. One is reminded immediately of an inconsummate number that cannot be written as \(x ÷ \mathrm{sod}(x) \) where \(\mathrm{sod}(\cdot) \) denotes the sum of digits. View my blog post about these latter numbers here.

Self numbers are base dependent. From Wikipedia:
In general, for even bases, all odd numbers below the base number are self numbers, since any number below such an odd number would have to also be a 1-digit number which when added to its digit would result in an even number. For odd bases, all odd numbers are self numbers. The set of self numbers in a given base q is infinite and has a positive asymptotic density: when q is odd, this density is 1/2.
D.R.Kaprekar, who introduced these numbers in 1949, gave the following test to determine quickly if a number is self.

Define the functions
\[
\begin{array}{lcl}
d(n)& = & \mathrm{the\ number\ of\ digits\ of\ }n\,,\\[1mm]
r(n)\vphantom{M^{M^M}a_{M_M}}&=& 1+({{(n-1)}\pmod9})\,, \\[1mm]
h(n)&=&\left\{%
\begin{array}{ll}
r(n)/2&\mathrm{\ if\ }r(n)\mathrm{\ is\ even}\,,\\
(r(n)+9)/2&\mathrm{\ if\ }r(n)\mathrm{\ is\ odd}\,.\\
\end{array}\right.\\
\end{array}
\]Then a number \(n\)  is self if, for every \(k=0,1,\dots,d(n)\), it holds
\[
\mathrm{sod}(|n-h(n)-9\cdot k|) \neq h(n)+9\cdot k\,
\]where \(|x|\)  denotes the absolute value of \(x\).

Kaprekar's algorithm of course makes it very easy to write the necessary SAGE code to identify self numbers within a given range of numbers. Here is the code that I developed:


If the SAGE code runs in the SAGE CELL window (sometimes there are glitches), you'll see the output 25407 25418 25420 25431 25442 and so 25418 marks the next occurrence of a self number. The first self numbers (OEIS A003052) are:
1, 3, 5, 7, 9, 20, 31, 42, 53, 64, 75, 86, 97, 108, 110, 121, 132, 143, 154, 165, 176, 187, 198, 209, 211, 222, 233, 244, 255, 266, 277, 288, 299, 310, 312, 323, 334, 345, 356, 367, 378, 389, 400, 411, 413, 424, 435, 446, 457, 468, 479, 490, 501, 512, 514, 525
A self prime is a self number that is prime (OEIS A006378). The first few self primes are:
3, 5, 7, 31, 53, 97, 211, 233, 277, 367, 389, 457, 479, 547, 569, 613, 659, 727, 839, 883, 929, 1021, 1087, 1109, 1223, 1289, 1447, 1559, 1627, 1693, 1783, 1873, ... 
Again from Wikipedia: "In October 2006 Luke Pebody demonstrated that the largest known Mersenne prime that is at the same time a self number is \(2^{24036583}−1 \). This is then the largest known self prime as of 2006."

By contrast, a junction number is one that can be written in more than one way as  \(x+\mathrm{sod}(x) \). For example, \(818 \)  is a junction number because it has two generators, \(796 \) and \(805 \). Indeed \[796+7+9+6 = 805+8+0+5 = 818.\]The first junction numbers are:
101, 103, 105, 107, 109, 111, 113, 115, 117, 202, 204, 206, 208, 210, 212, 214, 216, 218, 303, 305, 307, 309, 311, 313, 315, 317, 319, 404, 406, 408, 410, 412, 414, 416, 418, 420, 505, 507
It's easy enough to modify the previous SAGE code so that a list of junction numbers within a given range is generated:


The output generated from this code should be 101 103 105 107 109 111 113 115 117 together with the two smaller numbers that produce them. The junction numbers occur in runs of nine odd numbers and this is clearly seen in Figure 1 that shows the graph of such numbers between 1 and 1000.


Figure 1

Kaprekar's original paper can be viewed here.

Sunday, 24 June 2018

Numbers Aplenty

Today I just stumbled upon a new site that lists information about natural numbers. It's called Numbers Aplenty.


The categories under which numbers are classified looks like this:


So for instance, today I am 25284 days old and entering that number into the search box yields:
  • 25284 has 36 divisors (see below), whose sum is σ = 70224. Its totient is φ = 7056. 
  • The previous prime is 25261. The next prime is 25301. The reversal of 25284 is 48252 
  • Adding to 25284 its reverse (48252), we get a triangular number (73536 = T383). 
  • It is a Harshad number since it is a multiple of its sum of digits (21). 
  • 25284 is a Rhonda number in base 10. 
  • Its product of digits (640) is a multiple of the sum of its prime factors (64). 
  • It is a nialpdrome in base 14. 
  • It is a self number, because there is not a number n which added to its sum of digits gives 25284. 
  • It is an unprimeable number. 
  • It is a polite number, since it can be written in 11 ways as a sum of consecutive naturals, for example, 567 + ... + 609. 
  • 225284 is an apocalyptic number. 
  • It is an amenable number. 
  • It is a practical number, because each smaller number is the sum of distinct divisors of 25284, and also a Zumkeller number, because its divisors can be partitioned in two sets with the same sum (35112). 
  • 25284 is an abundant number, since it is smaller than the sum of its proper divisors (44940). 
  • It is a pseudoperfect number, because it is the sum of a subset of its proper divisors. 
  • 25284 is a wasteful number, since it uses less digits than its factorization. 
  • 25284 is an evil number, because the sum of its binary digits is even. 
  • The sum of its prime factors is 64 (or 55 counting only the distinct ones). 
  • The product of its digits is 640, while the sum is 21. 
  • The square root of 25284 is about 159.0094336824. The cubic root of 25284 is about 29.3504835430. 
  • The spelling of 25284 in words is "twenty-five thousand, two hundred eighty-four".
Many of the terms mentioned above I'd never heard before. The site will be a useful adjunct to the Online Encyclopedia of Integer Sequences or OEIS.