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.

A353652 Unique monotonic sequence of positive integers satisfying a(a(n)) = k*(n-1) + 3, where k = 5.

This page as a plain text file.
%I A353652 #26 Sep 22 2023 07:51:02
%S A353652 2,3,8,9,10,11,12,13,18,23,28,33,38,39,40,41,42,43,44,45,46,47,48,49,
%T A353652 50,51,52,53,54,55,56,57,58,59,60,61,62,63,68,73,78,83,88,93,98,103,
%U A353652 108,113,118,123,128,133,138,143,148,153,158,163,168,173,178,183,188
%N A353652 Unique monotonic sequence of positive integers satisfying a(a(n)) = k*(n-1) + 3, where k = 5.
%C A353652 Numbers m such that the base-5 representation of (2*m-1) starts with 3 or 4 or ends with 0.
%C A353652 First differences give a run of 5^i 1's followed by a run of 5^i 5's, for i >= 0.
%H A353652 Yifan Xie, <a href="/A353652/b353652.txt">Table of n, a(n) for n = 1..10000</a>
%H A353652 <a href="/index/Aa#aan">Index entries for sequences of the a(a(n)) = 2n family</a>
%F A353652 For n in the range (5^i + 1)/2 <= n < (3*5^i + 1)/2, for i >= 0:
%F A353652   a(n) = n + 5^i.
%F A353652   a(n+1) = 1 + a(n).
%F A353652 Otherwise, for n in the range (3*5^i + 1)/2 < n <= (5*5^i + 1)/2, for i >= 0:
%F A353652   a(n) = 5*(n - 5^i) - 2.
%F A353652   a(n+1) = 5 + a(n).
%e A353652 a(7) = 12 because (5^1 + 1)/2 <= 7 < (3*5^1 + 1)/2, hence a(7) = 7 + 5^1 = 12;
%e A353652 a(11) = 28 because (3*5^1 + 1)/2 <= 11 < (5*5^1 + 1)/2, hence a(11) = 5*(11 - 5^1) - 2 = 28.
%t A353652 a[n_] := Module[{n2 = 2n, p}, p = 5^Floor@Log[5, n2]; If[n2 < 3p, n+p, 5(n-p)-2]];
%t A353652 Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, Sep 22 2023, after _Kevin Ryde_ *)
%o A353652 (PARI) a(n) = my(n2=n<<1, p=5^logint(n2, 5)); if(n2 < 3*p, n+p, 5*(n-p)-2); \\ _Kevin Ryde_, Apr 18 2022
%o A353652 (C++)
%o A353652 /* program used to generate the b-file */
%o A353652 #include<iostream>
%o A353652 using namespace std;
%o A353652 int main(){
%o A353652     int cnt1=1, flag=0, cnt2=1, a=2;
%o A353652     for(int n=1; n<=10000; n++) {
%o A353652         cout<<n<<" "<<a<<endl;
%o A353652         if(cnt2==cnt1) {
%o A353652             flag=1-flag, cnt1=1;
%o A353652             if(flag) a+=1;
%o A353652             else {
%o A353652                 a+=5;
%o A353652                 cnt2*=5;
%o A353652             }
%o A353652         }
%o A353652         else {
%o A353652             cnt1++;
%o A353652             a+=(flag?5:1);
%o A353652         }
%o A353652     }
%o A353652     return 0;
%o A353652 }
%Y A353652 For other values of k: A080637 (k=2), A003605 (k=3), A353651 (k=4), this sequence (k=5), A353653 (k=6).
%K A353652 nonn,easy
%O A353652 1,1
%A A353652 _Yifan Xie_, Jul 15 2022