cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A172980 a(1)=1, a(2)=3; for n>=3, a(n) is the smallest number larger than a(n-1) such that, for every k a(n) is relatively prime to a(k) iff n is relatively prime to k.

This page as a plain text file.
%I A172980 #17 Jan 25 2017 08:39:29
%S A172980 1,3,4,9,11,12,13,15,16,33,37,42,43,117,154,159,163,168,173,231,338,
%T A172980 555,557,558,649,1161,1168,1209,1213,1254,1259,1263,1406,1467,1573,
%U A172980 1578,1579,2595,2752,2805,2813,2964,2969,2997,3014,5013,5021,5022,5057,5115
%N A172980 a(1)=1, a(2)=3; for n>=3, a(n) is the smallest number larger than a(n-1) such that, for every k<n, a(n) is relatively prime to a(k) iff n is relatively prime to k.
%C A172980 Using the Chinese remainder theorem, it is easy to prove that the sequence is infinite.
%H A172980 Alois P. Heinz, <a href="/A172980/b172980.txt">Table of n, a(n) for n = 1..500</a>
%p A172980 a:= proc(n) option remember;
%p A172980      local ok, m, k;
%p A172980      if n<3 then 2*n-1
%p A172980    else for m from a(n-1)+1 do
%p A172980           ok:= true;
%p A172980           for k from 1 to n-1 do
%p A172980             if igcd(n, k)=1 xor igcd(m, a(k))=1
%p A172980                then ok:= false; break fi
%p A172980           od;
%p A172980           if ok then break fi
%p A172980         od; m
%p A172980      fi
%p A172980     end:
%p A172980 seq (a(n), n=1..50);  # _Alois P. Heinz_, Nov 21 2010
%t A172980 a[1]=1; a[2]=3; a[n_] := a[n] = For[k = a[n-1]+1, True, k++, If[AllTrue[ Range[n-1], CoprimeQ[k, a[#]] == CoprimeQ[n, #]&], Return[k]]]; Table[ a[n], {n, 1, 100}] (* _Jean-François Alcover_, Jan 25 2017 *)
%Y A172980 Cf. A151976, A159559, A159560, A159615, A159619, A159629, A159698, A160217.
%K A172980 nonn
%O A172980 1,2
%A A172980 _Vladimir Shevelev_, Nov 21 2010
%E A172980 More terms from _Alois P. Heinz_, Nov 21 2010