A271720 a(1)=1; for n>1, define a sequence {b(m), m >= 1} by b(1)=n b(2)=13, and b(m) = A020639(b(m-2)) + A006530(b(m-1)); then a(n) is the number of terms in that sequence before the first of the infinite string of 4s.
8, 13, 15, 13, 4, 13, 12, 13, 15, 13, 4, 13, 16, 13, 15, 13, 12, 13, 15, 13, 15, 13, 4, 13, 4, 13, 15, 13, 8, 13, 12, 13, 15, 13, 4, 13, 12, 13, 15, 13, 4, 13, 8, 13, 15, 13, 12, 13, 12, 13, 15, 13, 12, 13, 4, 13, 15, 13, 4, 13, 8, 13, 15, 13, 4, 13, 12, 13, 15, 13, 8, 13, 11, 13, 15, 13, 12, 13
Offset: 1
Keywords
Examples
n = 6; the sequence is: 6, 13, 15, 18, 6, 5, 7, 12, 10, 7, 9, 10, 8, 4, 4, 4, ... There are 13 terms before the first of the infinite 4s; a(6) = 13. For n = 55633 the sequence is: 55633, 13, 55646, 27836, 6961, 6963, 7172, 166, 85, 19, 24, 22, 13, 15, 18, 6, 5, 7, 12, 10, 7, 9, 10, 8, 4, 4, 4, ... . As the first 4 comes as the 25th term, a(55633) = 24. - _Antti Karttunen_, Oct 01 2018
Links
- Antti Karttunen, Table of n, a(n) for n = 1..65537
Programs
-
Mathematica
Table[ Clear[h]; h[1]=x; h[2]=13; h[n_]:=FactorInteger[h[n-1]][[-1,1]]+FactorInteger[h[n-2]][[1,1]]; Position[Array[h,100],4][[1,1]]-1, {x,1,100}] (*This only works for x≠4*)
-
PARI
A006530(n) = if(n>1, vecmax(factor(n)[, 1]), 1); \\ From A006530 A020639(n) = if(1==n, n, factor(n)[1, 1]); A271720(n) = { my(up=1001, bvec = vector(up), m=1); bvec[1] = n; bvec[2] = 13; for(n=3,oo,bvec[n] = A020639(bvec[n-2])+A006530(bvec[n-1]); if(4==bvec[n], return(n-1))); }; \\ Antti Karttunen, Oct 01 2018
Comments