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.

A056753 Only odd numbers occur and for all k there are k numbers between any two successive occurrences of k.

This page as a plain text file.
%I A056753 #34 May 09 2025 11:39:32
%S A056753 1,3,1,5,1,3,1,7,1,3,1,9,1,3,1,7,1,3,1,11,1,3,1,7,1,3,1,13,1,3,1,7,1,
%T A056753 3,1,15,1,3,1,7,1,3,1,17,1,3,1,7,1,3,1,15,1,3,1,7,1,3,1,19,1,3,1,7,1,
%U A056753 3,1,15,1,3,1,7,1,3,1,21,1,3,1,7,1,3,1,15,1,3,1,7,1,3,1,23,1,3,1,7,1,3,1
%N A056753 Only odd numbers occur and for all k there are k numbers between any two successive occurrences of k.
%C A056753 Only the numbers 2^m - 1 occur more than once.
%C A056753 a(A005843(n)) = 1; a(A016813(n)) = 3; a(A004771(n)) = 7; a(A008598(n) + 35) = 15; a(A008598(n) + 155) = 31. - _Reinhard Zumkeller_, Aug 23 2009
%C A056753 A181497(n) = smallest m such that A056753(m) = 2*n + 1. - _Reinhard Zumkeller_, Oct 24 2010
%H A056753 R. Zumkeller, <a href="/A056753/b056753.txt">Table of n, a(n) for n = 0..10000</a>
%F A056753 Let x = a(n - A164632(n)), a(n) = if (x occurred exactly once so far) then x+2 else x. - _Reinhard Zumkeller_, Aug 23 2009
%t A056753 a[n_] := a[n] = (ClearAll[f]; f[i_, x_, y_, z_] := f[i, x, y, z] = If[i == n, If[x == 1, a[n-z] + 2, a[n-z]], If[x == 1, If[y == 1, f[i+1, 2z, z, 2z], f[i+1, z, y-1, z]], f[i+1, x-1, y, z]]]; If[n == 0, 1, f[1, 1, 1, 1]]); Table[a[n], {n, 0, 98}] (* _Jean-François Alcover_, Dec 14 2011, after _Reinhard Zumkeller_ *)
%o A056753 (Poly/ML)
%o A056753 fun A056753(n) =
%o A056753     let fun f(i, x, y, z) =
%o A056753             if i = n
%o A056753              then if x = 1
%o A056753                    then A056753(n - z) + 2
%o A056753                    else A056753(n - z)
%o A056753              else if x = 1
%o A056753                    then if y = 1
%o A056753                          then f(i + 1, 2*z, z, 2*z)
%o A056753                          else f(i + 1, z, y - 1, z)
%o A056753                    else f(i + 1, x - 1, y, z)
%o A056753      in if n = 0
%o A056753          then 1
%o A056753          else f(1, 1, 1, 1)
%o A056753     end;
%o A056753 (* _Reinhard Zumkeller_, Feb 25 2012, Aug 23 2009 *)
%o A056753 (Magma) S:=[ 0: n in [1..100] ]; k:=1; p:=Position(S, 0, 1); while p gt 0 do for j in [p..#S by k+1] do if S[j] eq 0 then S[j]:=k; else break; end if; end for; f:=p; p:=Position(S, 0, f); k+:=2; end while; S; // _Klaus Brockhaus_, Oct 25 2010
%o A056753 (Haskell)
%o A056753 import Data.List (intercalate, group)
%o A056753 a056753 n = a056753_list !! n
%o A056753 a056753_list = [1] ++ odds [] where
%o A056753    odds xs = xs ++ (intercalate xs' $ group [y+2,y+4..2*y+1]) ++ odds xs'
%o A056753         where y = 2 * length xs + 1
%o A056753               xs' = xs ++ [y] ++ xs
%o A056753 -- _Reinhard Zumkeller_, Feb 25 2012, Oct 24 2010
%Y A056753 Cf. A004771, A005843, A008598, A016813, A164632, A181497.
%K A056753 nice,nonn,look
%O A056753 0,2
%A A056753 Claude Lenormand (claude.lenormand(AT)free.fr), Jan 19 2001