PlanttPastes

euler 45

Jun 25th, 2026
38
0
Never
3
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. inline constexpr int64_t pentagonal(const int &n) {
  6.     return n * (3 * n - 1LL) >> 1;
  7. }
  8. inline constexpr int64_t hexagonal(const int &n) {
  9.     return n * (2 * n - 1LL);
  10. }
  11. bool isTriagonal(const int64_t &n) {
  12.     const int s = sqrt(n << 1);
  13.     return n << 1 == s * (s + 1LL);
  14. }
  15. bool isPentagonal(const int64_t &n) {
  16.     const int s = sqrt(n * 2 / 3);
  17.     return n == pentagonal(s) || n == pentagonal(s + 1) || n == pentagonal(s + 2) || n == pentagonal(s - 1) || n == pentagonal(s - 2);
  18. }
  19.  
  20. signed main() {
  21.     ios::sync_with_stdio(0);
  22.     cin.tie(0); cout.tie(0);
  23.     int i = 144;
  24.     while (!isPentagonal(hexagonal(i)) || !isTriagonal(hexagonal(i))) ++i;
  25.     cout << hexagonal(i);
  26. }
Advertisement
Comments
  • User was banned
  • User was banned
  • Rokzalny
    29 days
    # CSS 0.44 KB | 0 0
    1. Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment