All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
A common feature (Posted on 2017-10-29) Difficulty: 4 of 5
22 & 4,937,775 share a certain very distinctive feature.

1. What is it?
2. How would you call such numbers?
3. Please list some samples with the above feature.

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution researched solution Comment 1 of 1
Having searched Sloane's OEIS for 4937775, I'll answer #2 first: I'd call them Smith numbers or joke numbers; that's what they're called in Sloane's A006753.

Sloane gives the answer to #1:

composite numbers n such that sum of digits of n = sum of digits of prime factors of n (counted with multiplicity)

And for #3:

4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165

... and some interesting asides:

 
Of course primes also have this property, trivially.

The current puzzle of course doesn't necessarily imply that the primes are excluded from the class that is required, so possibly the puzzle is looking for a class consisting of primes and Smith numbers; maybe we could call them identiSOD numbers.

From Sloane also:

a(133809) = 4937775 is the first Smith number historically: 4937775 = 3*5*5*65837 and 4+9+3+7+7+7+5 = 3+5+5+(6+5+8+3+7) = 42, Albert Wilansky coined the term Smith number when he noticed the defining property in the phone number of his brother-in-law Harold Smith: 493-7775.

There are 248483 7-digit Smith numbers, corresponding to US phone numbers without area codes (like 4937775). - Charles R Greathouse IV, May 19 2013

I have confirmed via the below program that there are indeed 248483 7-digit Smith numbers (about a 15-minute run time for the program). However there is no correspondence with US phone numbers. 1000165, 1155122, 1454613, to take just a sampling, all begin with the digit 1, which no US phone number has, and 4691245, a valid US phone number, again, to take just one of many, is not a Smith number (it's 1 more than Smith number 4691244). 

Since there are 834564 lines in the output file, there are 834564 - 248483 = 586081 7-digit prime numbers in addition to the 248483 7-digit Smith numbers.

The program below creates a file with all the 7-digit prime (so marked) and Smith numbers.


DefDbl A-Z
Dim crlf$, ct, fct(20, 1)
Function mform$(x, t$)
  a$ = Format$(x, t$)
  If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$
  mform$ = a$
End Function

Private Sub Form_Load()
 Text1.Text = ""
 crlf$ = Chr(13) + Chr(10)
 Form1.Visible = True
 
 Open "smith numbers.txt" For Output As #2
 For n = 1000000 To 9999999
   DoEvents
   If prmdiv(n) = n Then
      Print #2, n; " prime"
   ElseIf smith(n) Then
      Print #2, n
      ct = ct + 1
   End If
   If n Mod 10000 = 0 Then Text1.Text = Text1.Text & Str(n)
 Next
 Close 2
 Text1.Text = Text1.Text & crlf & ct & "  done"
 
End Sub
 
Function factor(num)
 diffCt = 0: good = 1
 n = Abs(num): If n > 0 Then limit = Sqr(n) Else limit = 0
 If limit <> Int(limit) Then limit = Int(limit + 1)
 dv = 2: GoSub DivideIt
 dv = 3: GoSub DivideIt
 dv = 5: GoSub DivideIt
 dv = 7
 Do Until dv > limit
   GoSub DivideIt: dv = dv + 4 '11
   GoSub DivideIt: dv = dv + 2 '13
   GoSub DivideIt: dv = dv + 4 '17
   GoSub DivideIt: dv = dv + 2 '19
   GoSub DivideIt: dv = dv + 4 '23
   GoSub DivideIt: dv = dv + 6 '29
   GoSub DivideIt: dv = dv + 2 '31
   GoSub DivideIt: dv = dv + 6 '37
   If INKEY$ = Chr$(27) Then s$ = Chr$(27): Exit Function
 Loop
 If n > 1 Then diffCt = diffCt + 1: fct(diffCt, 0) = n: fct(diffCt, 1) = 1
 factor = diffCt
 Exit Function

DivideIt:
 cnt = 0
 Do
  q = Int(n / dv)
  If q * dv = n And n > 0 Then
    n = q: cnt = cnt + 1: If n > 0 Then limit = Sqr(n) Else limit = 0
    If limit <> Int(limit) Then limit = Int(limit + 1)
   Else
    Exit Do
  End If
 Loop
 If cnt > 0 Then
   diffCt = diffCt + 1
   fct(diffCt, 0) = dv
   fct(diffCt, 1) = cnt
 End If
 Return
End Function
 
Function sod(n)
  s$ = LTrim(Str(n))
  tot = 0
  For i = 1 To Len(s$)
   tot = tot + Val(Mid(s$, i, 1))
  Next
  sod = tot
End Function
 
Function smith(n)
  s1 = sod(n)
  f = factor(n)
  s2 = 0
  For i = 1 To f
   s2 = s2 + sod(fct(i, 0)) * fct(i, 1)
  Next
  If s1 = s2 Then
    smith = 1
  Else
    smith = 0
  End If
End Function

 
Function prmdiv(num)
 Dim n, dv, q
 If num = 1 Then prmdiv = 1: Exit Function
 n = Abs(num): If n > 0 Then limit = Sqr(n) Else limit = 0
 If limit <> Int(limit) Then limit = Int(limit + 1)
 dv = 2: GoSub DivideIt
 dv = 3: GoSub DivideIt
 dv = 5: GoSub DivideIt
 dv = 7
 Do Until dv > limit
   GoSub DivideIt: dv = dv + 4 '11
   GoSub DivideIt: dv = dv + 2 '13
   GoSub DivideIt: dv = dv + 4 '17
   GoSub DivideIt: dv = dv + 2 '19
   GoSub DivideIt: dv = dv + 4 '23
   GoSub DivideIt: dv = dv + 6 '29
   GoSub DivideIt: dv = dv + 2 '31
   GoSub DivideIt: dv = dv + 6 '37
 Loop
 If n > 1 Then prmdiv = n
 Exit Function

DivideIt:
 Do
  q = Int(n / dv)
  If q * dv = n And n > 0 Then
    prmdiv = dv: Exit Function
   Else
    Exit Do
  End If
 Loop

 Return
End Function


Sample output (the ones not marked prime are Smith):

 1000003  prime
 1000033  prime
 1000037  prime
 1000039  prime
 1000081  prime
 1000099  prime
 1000117  prime
 1000121  prime
 1000133  prime
 1000151  prime
 1000159  prime
 1000165 
 1000171  prime
 1000183  prime
 1000187  prime
 1000193  prime
 1000199  prime
 1000211  prime
 1000213  prime
 1000231  prime
 1000249  prime
 1000253  prime
 1000273  prime
 1000289  prime
 1000291  prime
 1000303  prime
 1000313  prime
 1000329 
 1000333  prime
 1000357  prime
 1000367  prime

 ...

 4916453  prime 
 4916461  
 4916467  prime 
 4916481  
 4916489  prime 
 4916557  prime 
 4916581  prime 
 4916591  prime 
 4916603  prime 
 4916629  prime 
 4916633  prime 
 4916637  
 4916643  
 4916659  
 4916669  prime 
 4916683  prime 
 4916707  prime 
 4916709  
 4916713  
 4916717  
 4916719  prime 
 4916741  prime 
 4916759  prime 
 4916771  prime 

 ...

 9999433  prime 
 9999454  
 9999463  prime 
 9999469  prime 
 9999481  prime 
 9999511  prime 
 9999520  
 9999533  prime 
 9999562  
 9999593  prime 
 9999601  prime 
 9999633  
 9999637  prime 
 9999653  prime 
 9999659  prime 
 9999667  prime 
 9999677  prime 
 9999713  prime 
 9999739  prime 
 9999742  
 9999749  prime 
 9999761  prime 
 9999778  
 9999823  prime 
 9999863  prime 
 9999877  prime 
 9999883  prime 
 9999889  prime 
 9999895  
 9999901  prime 
 9999907  prime 
 9999922  
 9999929  prime 
 9999931  prime 
 9999937  prime 
 9999943  prime 
 9999971  prime 
 9999973  prime 
 9999991  prime

  Posted by Charlie on 2017-10-29 11:35:41
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (23)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information