5^k - 4^k -- prog.sf 927 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/usr/bin/ruby
  2. # Numbers n such that 5^n - 4^n is not squarefree, but 5^d - 4^d is squarefree for every proper divisor d of n.
  3. # https://oeis.org/A280209
  4. # Probably in the sequence:
  5. # 2, 55, 171, 183, 203, 465, 955, 1027, 1711, 2485, 3197, 4431, 6275, 8515, 10121,
  6. #~ func f(k) {
  7. #~ k.divisors.first(-1).grep{_ < 150}.all {|d|
  8. #~ is_prob_squarefree(5**d - 4**d, 1e8)
  9. #~ #is_squarefree(5**d - 4**d)
  10. #~ }
  11. #~ }
  12. #~ for k in (1..100) {
  13. #~ var t = (5**k - 4**k)
  14. #~ if (!t.is_prob_squarefree(1e7) && f(k)) {
  15. #~ say k
  16. #~ }
  17. #~ else {
  18. #~ say "Counter-example: #{k}"
  19. #~ }
  20. #~ }
  21. #~ __END__
  22. func f(k) {
  23. k.divisors.first(-1).all {|d|
  24. is_prob_squarefree(5**d - 4**d)
  25. #is_squarefree(5**d - 4**d)
  26. }
  27. }
  28. for k in (1..30000) {
  29. var t = (5**k - 4**k)
  30. if (!t.is_prob_squarefree(1e6) && !t.is_prob_squarefree && f(k)) {
  31. print(k, ", ")
  32. }
  33. }