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

Home > Numbers
Ellis Number (Posted on 2015-01-31) Difficulty: 3 of 5
Break up an integer into all possible groups without changing the order in which the digits are arranged, then multiply each set of groups out and sum the products.

Example: 326. 3x2x6, + 32x6, + 3x26 gives 36 + 192 + 78 = 306. If the result equals the original integer, it's an Ellis number.

How many Ellis numbers are there in the integers up to 10,000?

Sometimes the process leads to an integer which isn't an Ellis number but which, when subjected to the same process, leads back to the original number, and is thus a sort of cyclic Ellis number. Find all cyclic Ellis numbers less than 10,000.

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution Comment 1 of 1
DefDbl A-Z
Dim crlf$, ns As String, sepsplaced, prevsep, stot, prod


Private Sub Form_Load()
 Text1.Text = ""
 crlf$ = Chr(13) + Chr(10)
 Form1.Visible = True
 
 Text1.Text = Text1.Text & ellis(326) & crlf & crlf & crlf & crlf
 DoEvents
 For n = 1 To 10000
   If ellis(n) = n Then
     Text1.Text = Text1.Text & n & crlf
     DoEvents
     ct = ct + 1
   ElseIf ellis(ellis(n)) = n Then
     Text1.Text = Text1.Text & n & Str(ellis(n)) & crlf
     DoEvents
     ct2 = ct2 + 1
   End If
 Next n
 Text1.Text = Text1.Text & "counts: " & ct & Str(ct2) & crlf
 
 
End Sub
Function ellis(x)
 ns = LTrim(Str(x))
 tot = 0
 For pieces = 2 To Len(ns)
   sepsplaced = 0: prevsep = 0: prod = 1: stot = 0
   subtot pieces
   tot = tot + stot
 Next
 ellis = tot
End Function

Sub subtot(pieces)
   For newsep = prevsep + 1 To Len(ns) - (pieces - 1 - sepsplaced)
     v = Val(Mid(ns, prevsep + 1, newsep - prevsep))
     saveprod = prod
     prod = prod * v
       
     sepsplaced = sepsplaced + 1
     saveprevsep = prevsep
     prevsep = newsep
     If sepsplaced = pieces - 1 Then
       prod = prod * Val(Mid(ns, newsep + 1))
       stot = stot + prod
     Else
       subtot pieces
     End If
     sepsplaced = sepsplaced - 1
     prevsep = saveprevsep
     prod = saveprod
       
   Next
End Sub

first evaluates 326, to test its own calculations, and correctly finds 306:

306

Then it finds 3 Ellis numbers under 10,000, as well as 4 that fit the given definition of "a sort of cyclic Ellis number":

148 192
155
192 148
1480 1920
1550
1920 1480
7305
counts: 3 Ellis, 4 cyclic, in 2 cycles(pairs).

The mutual numbers are shown paired on their lines, and the Ellis numbers get a line of their own and are bolded.

Extended to a million, there seems to be a pattern:


148 192
155
192 148
1480 1920
1550
1920 1480
7305
14800 19200
15500
19200 14800
73050
148000 192000
155000
192000 148000
730500

The 7305 joined the sequence a power of 10 multiple later than 155.  Could there be other beginnings that join?

  Posted by Charlie on 2015-01-31 14:53:59
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (0)
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