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

Home > Numbers
Numbers in pi (Posted on 2015-08-21) Difficulty: 2 of 5
What is the first 10-digit number in the decimal expansion of pi that contains each digit exactly once?

No Solution Yet Submitted by Math Man    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 3
Pi begins:

3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421

In the first 100,000 digits of pi, the condition asked for occurs 30 or 35 times, depending on whether you count 10-digit numbers with leading zeros:


     60   4592307816   1 1
     61   5923078164   2 2
   5470   2790814356   3 3
   5471   7908143562   4 4
   7115   4192705638   5 5
   8668   0457618932   6
  12768   5768134920   7 6
  16545   0395648127   8
  18805   9654032187   9 7
  18959   4726530981   10 8
  22259   8213496075   11 9
  23572   0758496231   12
  26399   1539628074   13 10
  29093   0632175894   14
  29382   2103598746   15 11
  30025   9462805371   16 12
  31120   6391708245   17 13
  36105   4985673021   18 14
  36222   3261879405   19 15
  46431   3578016924   20 16
  53221   4926718035   21 17
  53654   2697504318   22 18
  54013   8326107495   23 19
  56107   4629350871   24 20
  56629   5839240761   25 21
  56761   3720156498   26 22
  59716   1923407685   27 23
  66867   2761495038   28 24
  69531   1085264739   29 25
  70814   4510683729   30 26
  71596   9460835217   31 27
  73936   9236507184   32 28
  74180   0269584137   33
  88936   6340278519   34 29
  91917   6512907384   35 30

The positions shown in column 1 are relative to the first digit 1 after the decimal point being position 1.

Note the first two cases have an immediate overlap as a 4 is replaced by a different 4 in the first case and a 2 by a 2 in the second.


DefDbl A-Z
Dim crlf$, digitct(9)


Private Sub Form_Load()
 Form1.Visible = True
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)

 Open "\vb5 projects\flooble\pi.txt" For Binary As #1
 d$ = " "
 digs = 0
 For psn = 3 To LOF(1)
  Get #1, psn, d
  v = Val(d)
  digitct(v) = digitct(v) + 1
  If digitct(v) = 1 Then digs = digs + 1
  If psn > 12 Then
    Get #1, psn - 10, d
    v = Val(d)
    digitct(v) = digitct(v) - 1
    If digitct(v) = 0 Then digs = digs - 1
  End If
  If digs = 10 Then
    Text1.Text = Text1.Text & mform(psn - 9 - 2, "######0") & "   "
     ' sub 9 to get to beginning, sub 2 to avoid counting "3."
    s$ = Space$(10)
    Get #1, psn - 9, s
    ct1 = ct1 + 1: If Left(s, 1) <> "0" Then ct2 = ct2 + 1
    Text1.Text = Text1.Text & s & "   " & ct1
    If Left(s, 1) <> "0" Then Text1.Text = Text1.Text & Str(ct2)
    Text1.Text = Text1.Text & crlf
    DoEvents
  End If
 Next
 
 Text1.Text = Text1.Text & crlf & " done"
  
End Sub

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


  Posted by Charlie on 2015-08-21 10:34:23
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 (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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