A067133 n is a term if the phi(n) numbers in [0,n-1] and coprime to n form an arithmetic progression.
1, 2, 3, 4, 5, 6, 7, 8, 11, 13, 16, 17, 19, 23, 29, 31, 32, 37, 41, 43, 47, 53, 59, 61, 64, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 128, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241
Offset: 1
Examples
8 is a term as phi(8) = 4 and the coprime numbers 1,3,5,7 form an arithmetic progression. 17 is a member as phi(17) = 16 and the numbers 1 to 16 form an arithmetic progression.
References
- Marcin E. Kuczma, International Mathematical Olympiads, 1986-1999, The Mathematical Association of America, 2003, pages 6 and 61-62.
Links
- The IMO Compendium, Problem 2, 32nd IMO 1991.
- Index to sequences related to Olympiads.
Programs
-
Mathematica
rps[ n_ ] := Select[ Range[ 0, n-1 ], GCD[ #, n ]==1& ]; difs[ n_ ] := Drop[ n, 1 ]-Drop[ n, -1 ]; Select[ Range[ 1, 250 ], Length[ Union[ difs[ rps[ # ] ] ] ]<=1& ]
-
PARI
isok(n) = {my(v = select(x->gcd(x, n)==1, [1..n]), dv = vector(#v-1, k, v[k+1] - v[k])); if (#dv, if (vecmin(dv) != vecmax(dv), return(0))); return(1)} \\ Michel Marcus, Jan 08 2021
-
Python
from sympy import primepi def A067133(n): def bisection(f,kmin=0,kmax=1): while f(kmax) > kmax: kmax <<= 1 while kmax-kmin > 1: kmid = kmax+kmin>>1 if f(kmid) <= kmid: kmax = kmid else: kmin = kmid return kmax def f(x): return int(n+x-(x>5)+(0 if x<=1 else 1-primepi(x))-x.bit_length()) return bisection(f,n,n) # Chai Wah Wu, Sep 19 2024
Extensions
Edited by Dean Hickerson, Jan 15 2002
Comments