Skip to content

Instantly share code, notes, and snippets.

@dpiponi
Created April 3, 2024 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpiponi/c75a39dbaa8e875c74f25e0e20d7fbad to your computer and use it in GitHub Desktop.
Save dpiponi/c75a39dbaa8e875c74f25e0e20d7fbad to your computer and use it in GitHub Desktop.
Print the tribonacci numbers
#include <iostream>
// See https://arxiv.org/abs/2404.01483
long p(long x, long y, long z)
{
return x*x*x + 2*x*x*y + x*x*z + 2*x*y*y - 2*x*y*z - x*z*z + 2*y*y*y - 2*y*z*z + z*z*z;
}
const int N = 505;
int main()
{
for (long x = 1; x < N; ++x)
{
for (long y = x + 1; y < N; ++y)
{
for (long z = y + 1; z < N; ++z)
{
if (p(x, y, z) == 1)
{
std::cout << x << ' ' << y << ' ' << z << std::endl;
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment