This site is supported by donations to The OEIS Foundation.
User:Seth A. Troisi
Degree in Computer Science and Mathematics from Rose-Hulman.
Most of my code for OEIS is available at github.com/sethtroisi/OEIS/
I enjoy solving Project Euler problems and participate in GIMPs subprojects
Contents
Examples of PARI/Python/Mathematica for F.A.Q
When working on A359210 I searched for example PARI code and found several formats. The OEIS Wiki might benefit from a page giving examples of a simple function, a more multiline function, calling other functions for the most common languages (Is there any easy data on what the most common languages are? Feel free to answer here or in my talk)
Some of this is outlined in existing pages: Style Sheet (Maple), Style Sheet for Mathematica programs, PARI/GP, and possible others (please add here or in talk).
Maple
TODO
Mathematica
Covered by Style Sheet for Mathematica programs
PARI
From A056391
a(n)=sum(k=1, n, if(gcd(k, n)==1, 2^(sumdiv(n, d, eulerphi(d)/znorder(Mod(k, d)))-1), 0))/eulerphi(n);
From A030203
{a(n) = my(A); if( n<0, 0, A = x * O(x^n); polcoeff( eta(x + A) * eta(x^3 + A), n))};
Python
TODO how to handle imports? Which of these options (def a(n):, def A123456(n):, for i in range(10): print(...), A123456_list = [...]) is preferred?
From A063994
def a(n): if n == 1: return 1 return len([1 for witness in range(1, n) if pow(witness, n - 1, n) == 1]) [a(n) for n in range(1, 100)]
From A242788
A242788_list = [1, 2, 4, 5, 6] + [n for n in range(7, 10**6) if pow(n, n, n-3) == 3]
From A000120
def A000120(n): return bin(n).count('1')
Work on truncatable primes
See A024770 (right trunc), A024785 (left trunc), A077390 (left-right/bi trunc) In different bases: A076623 (total left) A076586 (total right),
See code on github at sethtroisi/OEIS/tree/main/A024770
Work on A069675
I initially discovered A069675 as part of some Project Euler and took up the task of increasing the known bounds.
In 2016 time Charles R Greathouse IV and Robert Israel had calculated up to a(300)
. I've extended this to a(434)
.
My code can be found on GitHub at sethtroisi/OEIS/A069675.
I spent quite sometime trying to get a GPU based Rabin-Miller primality test to work but have been unsuccessful.
n | a(n) |
---|---|
1 | 1 * 10 ^ 0 + 2 = 2 |
2 | 1 * 10 ^ 0 + 3 = 3 |
3 | 1 * 10 ^ 0 + 5 = 5 |
4 | 1 * 10 ^ 0 + 7 = 7 |
5 | 1 * 10 ^ 1 + 1 = 11 |
100 | 7 * 10 ^ 12 + 9 |
150 | 6 * 10 ^ 45 + 1 |
200 | 5 * 10 ^ 175 + 3 |
250 | 5 * 10 ^ 757 + 9 |
300 | 7 * 10 ^ 2559 + 3 |
350 | 4 * 10 ^ 11293 + 3 |
400 | 7 * 10 ^ 38079 + 3 |
430 | 7 * 10 ^ 91215 + 3 |
431 | 9 * 10 ^ 91836 + 1 |
432 | 1 * 10 ^ 92691 + 9 |
433 | 4 * 10 ^ 94286 + 9 |
434 | 1 * 10 ^ 98288 + 3 |