search.jl 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/usr/bin/julia
  2. # Smallest number that is the sum of two distinct n-th powers of primes in two different ways.
  3. # https://oeis.org/A338800
  4. # Smallest number that is the sum of two n-th powers of primes in two different ways.
  5. # https://oeis.org/A338799
  6. # Known terms for A338800:
  7. # 16, 410, 6058655748, 3262811042
  8. # Currently, no upper-bound for a(5) is known, assuming that a(5) exists.
  9. using Primes
  10. function search()
  11. a = 2
  12. upto1 = 10000
  13. upto2 = 50000
  14. k = 5
  15. table = Dict{BigInt, Int64}()
  16. while (a <= upto1)
  17. u = big(a)^k
  18. #b = nextprime(a+1)
  19. b = a
  20. while (b <= upto2)
  21. key = u + big(b)^k
  22. if (haskey(table, key))
  23. println(a, " ", b, " -> ", key)
  24. table[key] += 1
  25. else
  26. table[key] = 1
  27. end
  28. b = nextprime(b+1)
  29. end
  30. a = nextprime(a+1)
  31. end
  32. #~ for (k,v) in (table)
  33. #~ if (v >= 2)
  34. #~ println(k)
  35. #~ end
  36. #~ end
  37. return 0
  38. end
  39. search()