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

Home > Just Math
Palindromes and Divisibility (Posted on 2015-10-16) Difficulty: 3 of 5
How many positive palindromes less than 20150 are divisible by 7?

See The Solution Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 3
     7
    77
   161
   252
   343
   434
   525
   595
   616
   686
   707
   777
   868
   959
  1001
  1771
  2002
  2772
  3003
  3773
  4004
  4774
  5005
  5775
  6006
  6776
  7007
  7777
  8008
  8778
  9009
  9779
 10101
 10801
 11011
 11711
 12621
 13531
 14441
 15351
 16261
 16961
 17171
 17871
 18081
 18781
 19691
101101
108801
111111
118811
121121
128821
131131
138831
141141
148841
151151
158851
161161
168861
171171
178871
181181
188881
191191
198891

A total of 67 such numbers.

The numbers were sorted into ascending order after running

DefDbl A-Z
Dim crlf$


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

 
 For n = 1 To 201
   ns$ = LTrim(Str(n))
   nsr$ = ""
   For i = 1 To Len(ns)
     nsr = Mid(ns, i, 1) + nsr
   Next
   n1 = Val(ns + Mid(nsr, 2)): n2 = Val(ns + nsr)
   If n1 Mod 7 = 0 Then Text1.Text = Text1.Text & mform(n1, "#####0") & crlf: ct = ct + 1
   If n2 Mod 7 = 0 Then Text1.Text = Text1.Text & mform(n2, "#####0") & crlf: ct = ct + 1
 Next n


 Text1.Text = Text1.Text & ct & 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-10-16 10:50:58
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 (10)
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