3^k - 2^k -- prog.sf 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/usr/bin/ruby
  2. # Numbers n such that 3^n - 2^n is not squarefree, but 3^d - 2^d is squarefree for all proper divisors d of n.
  3. # https://oeis.org/A280203
  4. func f(k) {
  5. k.divisors.first(-1).grep{_ < 150}.all {|d|
  6. #is_prob_squarefree(2**d - 1, 1e8)
  7. is_squarefree(3**d - 2**d)
  8. }
  9. }
  10. #~ From ~~~~: (Start)
  11. #~ The following numbers are also in the sequence: {689, 732, 776, 903, 1055, 1081, 1332, 2525, 2628, 13861}.
  12. #~ Probably, the following numbers are also terms: {2054, 3422, 6416, 6482, 6516, 6806, 9591, 9653, 10386, 10506, 11026, 11342, 11772, 12656, 13203, 14878, 15657, 15922}. (End)
  13. # Smooth 10^4
  14. # 10, 11, 42, 52, 57, 203, 272, 497, 689, 732, 776, 903, 1055, 1081, 1332, 2054, 2525, 2628, 3422, 6416, 6482, 6516, 6806, 9591, 9653, 10386, 10506, 11026, 11342, 11772, 12656, 13203, 13861, 14878, 15657, 15922
  15. # Smooth 10^7
  16. # 10, 11, 42, 52, 57, 203, 272, 497, 689, 732, 776, 903, 1055, 1081, 1332, 2054, 2525, 2628, 3422, 6416, 6482, 6516, 6806
  17. for k in (
  18. 6806, 9591, 9653, 10386, 10506, 11026, 11342, 11772, 12656, 13203, 13861, 14878, 15657, 15922,
  19. ) {
  20. var t = (3**k - 2**k)
  21. if (!t.is_prob_squarefree(1e7) && f(k)) {
  22. say k
  23. }
  24. else {
  25. say "Counter-example: #{k}"
  26. }
  27. }
  28. __END__
  29. func f(k) {
  30. k.divisors.first(-1).all {|d|
  31. is_prob_squarefree(3**d - 2**d)
  32. }
  33. }
  34. for k in (1..30000
  35. ) {
  36. var t = (3**k - 2**k)
  37. if (!t.is_prob_squarefree(1e6) && !t.is_prob_squarefree && f(k)) {
  38. print(k, ", ")
  39. }
  40. }
  41. 6, 20, 21, 110, 136, 155, 253, 364, 602, 657, 812, 889, 979, 1081,