Talk:Brazilian numbers

From Rosetta Code
Revision as of 07:29, 17 August 2019 by rosettacode>Horst.h (→‎some observations not proofs: some more observations)

wee discrepancy

Is it possible to be a little more specific regarding the "wee discrepancy" with the F# version? <lang fsharp> printfn "%d" (Seq.item 3999 (Brazilian())) </lang> prints 4618--Nigel Galloway (talk) 17:05, 14 August 2019 (UTC)

OK I think I've found it--Nigel Galloway (talk) 17:37, 14 August 2019 (UTC)
I also noticed the difference two days ago, and I assumed that my REXX version was incorrect and was trying to find what the problem was in my computer program;   I was hoping somebody else would calculate the 100,000th Brazilian number and verify it (or not).     -- Gerard Schildberger (talk) 19:23, 14 August 2019 (UTC)

some observations not proofs

I tried to check the maximal base needed for an odd brazilian number.
If a number is brazilian the maximal base to test is always less equal number / 3.
If a number is prime and brazilian then the maximal base is square root of number.
Try it online!

// only primes are shown
    number      base      base*base
        13         3         9
        31         2         4
        43         6        36
        73         8        64
       127         2         4
       157        12       144
       211        14       196
       241        15       225
       307        17       289
       421        20       400
       463        21       441
       601        24       576
       757        27       729
      1093         3         9
      1123        33      1089
      1483        38      1444
..
     55987         6        36
     60271       245     60025
     60763       246     60516
     71023       266     70756
     74257       272     73984
     77563       278     77284
     78121       279     77841
     82657       287     82369
     83233       288     82944
     84391       290     84100
     86143       293     85849
     88741        17       289
     95791       309     95481
     98911       314     98596
odd brazilian numbers 7 .. 100000 : 40428
slots:  base/number 
  <=1/12 <= 2/12  <=3/12  <=4/12
   30717    4013    2225    3473       0       0       0       0       0       0       0       0


Thanks, Mr. Horst (userid Horst.h),   I added (the non-prime hint) to the REXX program and it speeded it up by a factor of two.     -- Gerard Schildberger (talk) 21:51, 15 August 2019 (UTC)
some more observations by factorization of the numbers:
Brazilian primes always have "1" as digit.MaxBase = trunc(sqrt(prime))-> "111" and therefor are rare 213 out of 86400.
So one need only to test if digit is "1" for prime numbers.
    number = factors    base     repeated digit
         7 = 7         2         1      "111" to base 2
        13 = 13         3         1     "111" to base 3
        31 = 31         2         1     "11111" to base 2
        43 = 43         6         1
        73 = 73         8         1
       127 = 127         2         1   "1111111" to base 2 
       157 = 157        12         1
--
       601 = 601        24         1
       757 = 757        27         1
      1093 = 1093         3         1   "1111111" to base 3
...
    987043 = 987043       993         1
   1003003 = 1003003      1001         1
   1005007 = 1005007      1002         1
   1015057 = 1015057      1007         1
   1023133 = 1023133      1011         1
   1033273 = 1033273      1016         1
   1041421 = 1041421      1020         1
   1045507 = 1045507      1022         1
   1059871 = 1059871      1029         1  "111" to base 1029
Max number  1084566 -> 84600 primes
Brazilian primes found 213

How about nonprime odd numbers?

    number = factors    base     repeated digit
        15 = 3*5          2         1  = "1111" also "33" to base 4  -> ( 5-1) 
        21 = 3*7          4         1  = "111" also "33" to base 6  -> ( 7-1) 
        27 = 3^3= 3*9     8         3  
        33 = 3*11        10         3   
        35 = 5*7          6         5
        39 = 3*13        12         3
        45 = 3^2*5        8         5  
        51 = 3*17        16         3
        55 = 5*11        10         5
        57 = 3*19         7         1  also "33" to base 18 
        63 = 3^2*7        2         1  also "77" to base 8    
        65 = 5*13        12         5 
        69 = 3*23        22         3
        75 = 3*5^2       14         5
        77 = 7*11        10         7
        81 = 3^4=3*27    26         3
        85 = 5*17         4         1   also "55" to base 16
        87 = 3*29        28         3
        91 = 7*13         9         1
        93 = 3*31         5         3
        95 = 5*19        18         5
        99 = 3^2*11      10         9  
       105 = 3*5*7       14         7 
       111 = 3*37        10         1 also "33" to base 36

I think, taking the factorization of the number leave the highest factor -1 > sqrt( number) as base and the rest as digit.Something to test.Horst.h