# From: Jon Schoenfield (jonscho(AT)hiwaay.net) # Subject: b-file for A003166 # Date: Fri, 8 May 2009 15:54:51 -0500 # # I've = attached a b-file containing all terms in A003166 less than 2^48. Some # observations that allowed a fast search: # # Other than a(1) = 0, all terms in the sequence must, of course, be # odd. # # All odd numbers j have the property that j^2 mod 8 = 1, so, in base 2, # j^2 (if it's at least 4 digits long) must end in 001, and if it's # palindromic, then it must begin with 100, so, for j^2 > 7, we can limit # the search to odd numbers j such that j^2 lies in the ranges # # 8 < j^2 < 10, # 16 < j^2 < 20, # 32 < j^2 < 40, etc. # # We can cut in half the number of possible values of j needing to be # checked if we note further that # # - for integers j such that j^2 mod 16 = 1, j mod 8 = 1 or its # complement, 7 # - for integers j such that j^2 mod 16 = 9, j mod 8 = 3 or its # complement, 5 # # so, for j^2 > 15, we can limit the search to numbers j = 8*k +/- 1 # (here and below, k is any positive integer) with j^2 starting with 1000, # i.e., in the ranges # # 16 < j^2 < 18, # 32 < j^2 < 36, # 64 < j^2 < 72, etc. # # and numbers j = 8*k +/- 3 with j^2 starting with 1001, i.e., in the # ranges # # 18 < j^2 < 20, # 36 < j^2 < 40, # 72 < j^2 < 80, etc. # # Extending this one step further, # # - for integers j such that j^2 mod 32 = 1, j mod 16 = 1 or its # complement, 15 # - for integers j such that j^2 mod 32 = 9, j mod 16 = 3 or its # complement, 13 # - for integers j such that j^2 mod 32 = 17, j mod 16 = 7 or its # complement, 9 # - for integers j such that j^2 mod 32 = 25, j mod 16 = 5 or its # complement, 11 # # so, for j^2 > 31, we can limit the search to numbers j = 16*k +/- 1 # with j^2 starting with 10000, i.e., in the ranges # # 32 < j^2 < 34, # 64 < j^2 < 68, # 128 < j^2 < 136, etc., # # numbers j = 16*k +/- 3 with j^2 starting with 10010, i.e., in the # ranges # # 36 < j^2 < 38, # 72 < j^2 < 76, # 144 < j^2 < 152, etc., # # numbers j = 16*k +/- 7 with j^2 starting with 10001, i.e., in the # ranges # # 34 < j^2 < 36, # 68 < j^2 < 72, # 136 < j^2 < 144, etc., # # and numbers j = 16*k +/- 5 with j^2 starting with 10011, i.e., in the # ranges # # 38 < j^2 < 40, # 76 < j^2 < 80, # 152 < j^2 < 160, etc. # # (Extending the above by several more steps makes it easy to check all # possible values of j up into the trillions.) # # I'm sure the above could all be written much more succinctly! # 1 0 2 1 3 3 4 4523 5 11991 6 18197 7 141683 8 1092489 9 3168099 10 6435309 11 12489657 12 17906499 13 68301841 14 295742437 15 390117873 16 542959199 17 4770504939 18 17360493407 19 73798050723 20 101657343993 21 107137400475 22 202491428745 23 1615452642807 24 4902182461643 25 9274278357017 26 12863364360297 27 18242038950999 28 18600264487591 29 25100748703521 30 39192943705973 31 154737433904091